Hi!
I am new to C#. Now I have one project which needs to read a 130kb xml file, and display some of its data with a GUI.
What component I should use to display the data? I need a combobox to select between different datasets.
Anyone can help. Thanks a lot.....Thanks
BR
Emma
Loading
Emma EmmaPosted Apr 26, 2013, 6:11 AM
Here is my result. I can make it in ListBox. But the first three should be in one row. not column.
That is why I want it in DataGridView.
Can anyone help me with this: only select part of the nodes, and every node only display three items...
Thanks
//// three items from one node
100
A10
Low Filter
Emma EmmaPosted Apr 26, 2013, 4:48 AM
Shankar MPosted Apr 26, 2013, 3:19 AM
Can you Please try checking this,
http://csharp.net-informations.com/xml/xml-to-datagridview.htm
Emma EmmaPosted Apr 26, 2013, 2:01 AM
Shankar MPosted Apr 25, 2013, 12:29 AM
Hope this link might help you.
http://www.c-sharpcorner.com/UploadFile/c5c6e2/binding-xml-data-to-listview-control-dataset-approach/
Jignesh TrivediPosted Apr 24, 2013, 11:25 PM
hi,
Please refer following link it might help you.
http://support.microsoft.com/kb/308333
http://www.codeproject.com/Articles/9494/Manipulate-XML-data-with-XPath-and-XmlDocument-C
http://shahvaibhav.com/how-to-read-xml-attributes-using-xpath-in-c/
Emma EmmaPosted Apr 24, 2013, 5:37 AM
Emma EmmaPosted Apr 24, 2013, 5:35 AM
Ravikumar GPosted Apr 24, 2013, 5:21 AM
Ravikumar GPosted Apr 24, 2013, 4:52 AM
Emma EmmaPosted Apr 24, 2013, 4:52 AM
Emma EmmaPosted Apr 24, 2013, 4:41 AM
Jignesh TrivediPosted Apr 24, 2013, 3:52 AM
It only shows the first line of xml file, I think reason behind we are taking first table of dataset.
var dymmydataTable = ds.Tables[0];
it might be possible, other datatable of the dataset has value that you required.
also please share sample of your xml file.
Ravikumar GPosted Apr 24, 2013, 2:43 AM
Emma EmmaPosted Apr 24, 2013, 2:19 AM
Jignesh TrivediPosted Apr 23, 2013, 9:04 AM
Answer is as below
1) Yes
2) no , you do nothing after this.
in above piece of code we already assign new data in to newdt data table.
hope this will help you.
Emma EmmaPosted Apr 23, 2013, 8:17 AM
Hi,
I think your idea is doable for my project. Can you tell me
is newdt is a data table?
After this :dataGridView1.DataSource = newdt; I should copy the data from table to dataset. Is that so? And How to do this.. I get confused ...
Thanks !
BR
Emma
Emma EmmaPosted Apr 23, 2013, 7:51 AM
Yes. I am trying to do it with the code you gave...but ..I never use C# before, this gives little challenge to me... But lets see. Maybe I will make it !Thanks so much.
BR Emma
Jignesh TrivediPosted Apr 23, 2013, 7:44 AM
hi,
from this above code you might got the idea how to accomplish the task.
I am sure that above code can help you to build your own logic.
Emma EmmaPosted Apr 23, 2013, 7:21 AM
Jignesh TrivediPosted Apr 23, 2013, 6:31 AM
ok ideally you want to show first 200 and on next button click want to show next 200.
right?
to achieve this you have to introduced you own logic.
I have try with following code it work. it might also work for you
try
// page index is change from your next or previous button
int pageIndex = 0;
int pageRecord = 200;
DataTable newdt;
var dymmydataTable = ds.Tables[0];
//if record is in between current
if ((pageIndex + 1) * pageRecord > dymmydataTable.Rows.Count)
{
newdt = dymmydataTable.AsEnumerable().Skip(pageIndex * pageRecord).CopyToDataTable();
}
else
{
newdt = dymmydataTable.AsEnumerable().Skip(pageIndex * pageRecord).Take((pageIndex + 1) * pageRecord).CopyToDataTable();
}
hope this will help you.
Emma EmmaPosted Apr 23, 2013, 6:04 AM
Thanks again.
But the problem is that my .xml file may change, my program should work for different files not only one. So I can not count how many to take or to skip.
The only thing I have is that the ID is different.. some is 100 -200 some is 400,500...
so I need to split them ...:(
Hope you understand what I mean
BR
Emma
Jignesh TrivediPosted Apr 23, 2013, 5:53 AM
hi,
there is good idea to create other datasource and assign it to data grid view.
DataSet ds = new DataSet();
ds.ReadXml(@"E:\test\testProject\testProject\testProject\XMLFile1.xml");
//here you may specify the page numbers instead of 200.
var newdt = ds.Tables[0].AsEnumerable().Skip(200).Take(200).CopyToDataTable();
datagrid1.DataSource = newdt;
hope this will help you.
Emma EmmaPosted Apr 23, 2013, 4:30 AM
Jignesh TrivediPosted Apr 22, 2013, 3:17 AM
I thing, you can use datagrid view control show the selected table data.
DataSet ds = new DataSet();
ds.ReadXml(@"E:\test\testProject\testProject\testProject\XMLFile1.xml");
are you using window base application or web base application?
both type of application containing datagrid.
hope this will help you.