Hai friends,
I am doing a VB.NET windows application. In that I am selecting nodes from XML File. My XML File Format looks as given below.
xml version="1.0" encoding="utf-8"?>
<MsgRoot>
<Msg>
<MsgID>AB1MsgID>
<MsgDesc>AB-CVAMsgDesc>
<Field_cnt>9Field_cnt>
<Action>1Action>
<Response>3Response>
Msg>
<Msg>
<MsgID>AB2MsgID>
<MsgDesc>AB-AMTMsgDesc>
<Field_cnt>10Field_cnt>
<Action>1Action>
<Response>3Response>
Msg>
<Msg>
<MsgID>AB1MsgID>
<MsgDesc>AB-JJSMsgDesc>
<Field_cnt>9Field_cnt>
<Action>1Action>
<Response>3Response>
Msg>
<Msg>
<MsgID>AB1MsgID>
<MsgDesc>AB-ICMsgDesc>
<Field_cnt>12Field_cnt>
<Action>1Action>
<Response>3Response>
Msg>
MsgRoot>
What I want to do is I want to select nodes with MsgID = AB1 and display those details in DataGrid. In datagrid I want to display only
MsgDesc,Field_cnt,Action,Response. That is I don’t want to display MsgID. How I can do ths. Can anybody help me. I tried many ways. But none is working. Any help appreciated.
Thanks in Advance
Satish KathiPosted Jul 31, 2008, 4:07 PM
Here is the C# code please convert it to VB
string xmlFile = "yor XML File Name"; XmlDocument xdoc = new XmlDocument();xdoc.Load(xmlFile);
XmlNode xnode = xdoc.SelectSingleNode("/MsgRoot/Msg[MsgID='AB1']"); XmlNodeReader nr = new XmlNodeReader(xnode); DataSet ds = new DataSet();ds.ReadXml(nr);
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].Visible =
false;Hope this helps