|
As you've already been pointed out, itterating over every node is both inefficient and unnecessary.
I suggest you read up on XPath , which gives you a way of navigating to specific nodes using the SelectSingleNode and SelectNodes methods on an XmlNode .
The XPath you want looks for Table nodes with a specific content in the KdProject child. It looks like this for example: Table[KdProject = '901561']
So you can find the node you're after using (assuming xDoc is the XmlDocument instance):
XmlNode node= xDoc.DocumentElement.SelectSingleNode("Table[KdProject = '901561']")
and you can delete that node:
xDoc.DocumentElement.RemoveChild(node);
you should now be able to adapt your code to use this to repeat the deletion for every row in your data table.
|
|
|
|
|
I think the code, can remove just one row, how I can remove xml node based on KdProject tags
The original xml :
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901561</KdProject>
<NmProject>Bussan - 2891000497 - Citrix</NmProject>
</Table>
<Table>
<KdProject>901559</KdProject>
<NmProject>Acer - 2881001136 - LAN Switching </NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
</NewDataSet>
The result that I want :
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
</NewDataSet>
Please help,
Thx
|
|
|
|
|
Are you being serious??? If you can't work out how to do that from the code i provided then you need to go and buy a beginner book on programming and work through it.
|
|
|
|
|
Hi
I have a problem,
I have one textbox, and one datagrid.
If value in textbox is matching with value in specfic colum in datagrid then select this row in datagrid
|
|
|
|
|
You forgot to tell us your problem.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
ooo sorry,
my problem is that, i don't know how to select specific row in datagrid, if textbox value is matching with value in spacific colum.
If i write number 2222 in textbox, i want that the row in datagrid, whwrw this number is, is selected.
I hope it's understanding.
i will be very helpful.
|
|
|
|
|
|
Plz can anyone help me to get a code in c# that extract Ethernet type.
I have a function which I recieve Ehternet Packet but I dont know how I can get out Ehternet type from it.
Thanks in advanced
Merh
private void ReceivePacket(object sender, PacketHeader p, byte[] s)
{
this.pack_count++;
rtb.Focus();
rtb.AppendText("Content of p : \n");
rtb.AppendText(" Caplength: " + p.Caplength + "\n");
rtb.AppendText(" Length : " + p.Length + "\n");
rtb.AppendText(" Timestamp: " + (p.TimeStamp) + "\n");
Ethernet type?????
}
|
|
|
|
|
How is defined PacketHeader ?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: How is defined PacketHeader
Not very, I suspect
|
|
|
|
|
Ethertype is in the byte[] s but I dont know how I can extract it.
Regards
mehran
|
|
|
|
|
I have this GUI project written in C# that loads pictures and graphical analog gauges. Also, it has a skin from SkinCrafter. When this GUI app is launched and starts to paint on the screen, the painting is not smooth in a way that the pictures and graphics appears in all direction, meaning, for instance, not just from top going down its bottom, and this happens with delays. Do you have an idea how can I make this appear smoothly, or one direction only.
Thanks a lot in advance.
Lem
_
|
|
|
|
|
You can show splash screen while your main form is being initialized. When initialization ends, close the splash screen. There are several good articles here on codeproject about developing splash screens.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
SuspendLayout / ResumeLayout might also prove handy here depending on what you're looking for, can't quite envisage what's going on from your description.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
The controls are going to be painted in the order that they are added to the Controls collection in the form. As has been suggested, you can use a splash screen or SuspendLayout/ResumeLayout.
|
|
|
|
|
|
Hi,
Kindly help me for that, I want to receive cursor position and pixel value/color when the cursor is moving on desktop or on other application.
Thank you
(Riaz)
|
|
|
|
|
You can get the cursor from Mouse.X and Mouse.Y, something like that. You'd need to grab a screenshot to get the color of a pixel off your mouse position.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I don't know how to get the pixel value color... But...
You can get the position of the mouse using this code:
<br />
[DllImport("user32.dll")]<br />
static extern bool SetCursorPos(int X, int Y);<br />
<br />
[DllImport("user32.dll")]<br />
static extern int GetCursorPos(ref tPoint lpPoint);<br />
<br />
struct tPoint { public int X, Y; }<br />
<br />
public static Point GetCursorPoint()<br />
{<br />
tPoint point;<br />
point.X = 0; point.Y = 0;<br />
GetCursorPos(ref point);<br />
return new Point(point.X, point.Y);<br />
}<br />
Christian was right to say that you can get it using Mouse.GetState() alot easier though.
Mark.
|
|
|
|
|
it is very good method to learn that, where is mouse cursor moving.
Thank you
|
|
|
|
|
i am having single table with col'n serviceID, name , ParenID.
eg,
ServiceID Name ParentID
1 aaaa 0
2 bbbb 1
3 cccc 1
4 dddd 2
etc.
In hierarchical grid when i click on aaa it will display a child grid
with a data bbb,ccc .When I click on bbb it will display data (dddd)
in a another sub child grid. So as data in table increases the child
grid will increase.
So can anybody mail me a code for developing a infinite level
hierarchical data grid with edit update option
|
|
|
|
|
There are several solutions to solve this problem...
You can load the table at once and populate your interface manually in code
<br />
function Populate()<br />
{<br />
PopulateChildren(Table, ID)<br />
}<br />
<br />
function PopulateChildren(Table, ParentID)<br />
{<br />
PopulateChildren(Table, ID)<br />
}<br />
However, the solution of which I think is neater, is create a dataset what several tables and create DataRelations between them to create the parent-child hierarchie. This way you can fetch child and parent rows by using a certain datarow's GetChildRows() and GetParentRow() method... However, since the hierarchie is infinite, you may have difficulties creating that dataset... When creating a dataset I always user constants to store the name of DataRelations etc in, having such a dynamic dataset makes that impossible... Think wise
|
|
|
|
|
ya i collect data in parent child relation but my disply is not look good
so i need a code how give correct disply 2 the datagrid like tree view
|
|
|
|
|
I am doing a multi threaded application. In this application, configurations are kept in an XML file and loaded as a singleton instance. I have a class to manage this XML file say Configuration . This Configuration class has a Current property which is a singleton instance.
private static object locker = new object();
private static Configuration _configuration;
public static Configuration Current
{
get
{
if(_configuration == null)
{
lock(locker){
_configuration = LoadConfiguration();
}
}
return _configuration;
}
} Is this code thread safe ? Assume first thread has locked and started to fill the _configuration instance. But before it completes, another thread requests the Current property and comes inside the if block. It will be queued until the lock gets released. But after the lock gets released, will that thread creates the instance again ? I am kinda confused at this point. Any help ?
|
|
|
|
|
Hi Navaneeth,
no it is not OK. You need to test for null after you got the lock.
you MAY test before TOO, to improve performance (i.e. avoid acaquiring the lock
on all visits but the first).
So typical code sequence is: test, lock, test again, do, unlock
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|