|
-
Feb 18th, 2007, 02:50 PM
#1
Thread Starter
New Member
[2.0] dataGridView + XML
Good Evening,
Straight to the point:
I have a dataGridView that is populated with an xml file, as follows:
Code:
private void Form1_Load(object sender, EventArgs e)
{
string filePath = "SessionsList.xml";
dataSet1.ReadXml(filePath);
dataGridView1.DataSource = dataSet1;
dataGridView1.DataMember = "server";
}
Which works great, I have it set exactly how I want it. Now as for the problem, at the moment its just a local file, but i plan to download it live from some website (my own..) eventually..
The problem I have is i want it to update, either manually (user clicking "update") or every so often with a timer.. but i cant seem to get it to work.. I've tried the following code:
Code:
void UpdateSessionList()
{
dataGridView1.Refresh();
string filePath = "SessionsList.xml";
dataSet1.ReadXml(filePath);
dataGridView1.DataSource = dataSet1;
dataGridView1.DataMember = "server";
}
I've also tried, dataSet1.Table.Clear(); they either clear the table and dont re-populate it, or just re-add the same xml data to the table, so it repeats over and over.. can someone please help me out?
Also as a side note, I have a context menu on the GridView that at the moment shows a messagebox, i want it to show say.. the IP of the selected row.. if you get what i mean..
Thanks for your time.
Michael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|