|
I want to add an Icon image to a dll in runtime.
How can i do this plz hit?
Thanks i advance.
|
|
|
|
|
Without recompiling it there is no easy way to accomplish this.
|
|
|
|
|
<Clips>
<clip name="smoking.mp4" id="1" type="d" />
<clip name="smoking1.mp4" id="1" type="d" />
<clip name="divorce.mp4" id="2" type="d" />
</Clips> I have the above XML file. Which is the best and efficient way to get all "CLIP" nodes which have id="1". I am not able to use LINQ here as I am doing this in C# 2.0. Any suggestions ?
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.Load(@"myfile.xml");<br />
XmlNode clipsNode = xmlDoc.SelectSingleNode("/Clips");<br />
foreach(XmlNode clipNode in clipsNode.ChildNodes)<br />
{<br />
XmlAttribute nameAttr = clipNode.Attributes["name"];<br />
XmlAttribute idAttr = clipNode.Attributes["id"];<br />
XmlAttribute typeAttr = clipNode.Attributes["type"];<br />
<br />
Console.WriteLine(nameAttr.Value);
Console.WriteLine(idAttr.Value);
Console.WriteLine(typeAttr.Value);
}
|
|
|
|
|
Thanks. I was going through XPathNavigator documentation which looks more efficient. What do you think ?
|
|
|
|
|
The code is similar. Just use SelectNodes instead of SelectSingleNode, and use an xpath expression that selects the nodes you want instead of selecting the parent node.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Thanks Guffa. I have tried XPath and it successfully worked with XPathNodeIterator . But it don't have any methods which can return the current node. So I did that in the following way, is any other method available other than this ?
while (iterator.MoveNext())
{
if (iterator.Current is IHasXmlNode)
{
XmlNode xNode = ((IHasXmlNode)iterator.Current).GetNode();
objList.Add(xNode);
}
} This code gives me a collection of Nodes got from the iterator. Any other efficient method for this ?
|
|
|
|
|
Ok, since you are asking for efficient code
N a v a n e e t h wrote: if (iterator.Current is IHasXmlNode)
{
XmlNode xNode = ((IHasXmlNode)iterator.Current).GetNode();
objList.Add(xNode);
}
is operator looks up type of iterator.Current and checks if it is of type IHasXmlNode or derived, and returns true or false.
Cast does the same lookup and check, only it returns IHasXmlNode or throws invalid cast exception.
For this pattern there is as operator, which does the same check, and return IHasXmlNode if it succeeds or null if it fails. One null check is faster then type lookup & check. While it is possible that JIT recognizes this pattern and optimize your code anyway, I wouldn't bet on it
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
dnh wrote: For this pattern there is as operator, which does the same check, and return IHasXmlNode if it succeeds or null if it fails. One null check is faster then type lookup & check.
That's good. That's a new information for me. Thanks
|
|
|
|
|
hi all i'am beginner in .net anybdy can u help me how to create connection to oracle or sqlserver 2000 with using by C#...?
thank's
biengupta
|
|
|
|
|
|
ok, thank's a lot!!
|
|
|
|
|
Hello frnds,
i am reading a Xml file using XmlReader,code is
XmlTextReader rdrXml = new XmlTextReader(strFilename);
xmlElement XmlEle = new xmlElement();
switch (rdrXml.NodeType)
{
case XmlNodeType.Element:
//here i want to store the Element in
saparate Element Variable like
XmlEle = rdrXml.LocalName
break;
}
The BOLD line gives me error..
where i am wrong ...i want to get the parent Name of that XMLElement
how can i do that???
please help...
Thankx in advance
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Usually the error message gives some insight...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
hi
iam having an aspx page which is having a hyper link search.if it is clicked another message box(which is also an aspx page)will be opened which is having a text box and find button.i will enter some text in the text box and click the find button then the value in the text box is retrieved and shown in the text box in the aspx page...iam not getting any idea,can anyone tell me the javascript codr to do this.
Thanx in advance
pintoo
|
|
|
|
|
Hi,
as long as i known this control i've always used it by incrementing Known Steps
like a For Loop :
<br />
for (int i = 0; i < length; i++)<br />
{<br />
progressBar1.Increment(1);<br />
}<br />
now i want him to do so but for Operations Loke : (Do func1, and Func2....)
and to update the progres not by steps but with Time...
What i mean is to BIND the ProgressBar to an operation
Can anybody show my the way....
THANKS
Have Fun
Never forget it
|
|
|
|
|
You have to hand craft that binding. The simplest way is updating the progress bar status inside the operations themselves.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
|
half-life wrote: i thougt about it, but it's not that simple
(how said life is simple?, )
Oh, I know, of course: my sign is all about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
i working on 2 parts application
windows service
and windows application
i want to attach them to the same configuration file.
is it possible.
and if it yes how shuold i do it ?
and if it is not?
what other solution.
regards
|
|
|
|
|
|
Hello Friends,
I am developing an application using C#.NET and SQL Server 2000 in this application i am getting date from server that is in (MM/DD/YYYY) format and match with system date but in system the date is in (DD-MM-YYYY) format whenever i match the date it shows an error message.
So can you give me the solution to set compatability between these two dates
|
|
|
|
|
Choose one step
1. Before comparing convert the system date to sql date formate.
2. Or before comparing convert the date formate in to system formate after comparing convert it aging to you working environment desire formate.
|
|
|
|
|
If you're using DateTime objects, surely they should compare correctly?
If you're using strings, how difficult is it to convert an MMDDYYYY string to DDMMYYYY or vice versa?
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
... and use ISO 8601-compliant date formats (YYYY-MM-DD).
|
|
|
|