March 28th, 2013, 05:55 PM
C# - VS 2012 - Looping through DataSet table
I am losing the will to live here,
I have installed VS 2012 after many years using VS 2010 and to my horror, I can't even manage to loop through effin table rows anymore (which was a doddle before) and it is absolutely critical to my project.
I am coding in C# in a WPF project.
I tried many ways of calling DataGrid.Rows but that is no longer available to users at all (don't know what on earth Microsoft were thinking of here) so I am trying to find a work around and here is what i have come up with from the top of my cranium but the second part is just not working for me.
Just to make things simpler (the code not working is just so lengthy it would be counter-constructive to post it here and instead let's try and get a messagebox to show the value of the cell in the 2nd column of the row looked at.
foreach (TableRow row in MyDatabaseDataSet.Tables["Table1"].Rows)
//Pesky lengthy non-working code supposed to generate controls dependent on row cell value
But nothing does it.
I tried many many ways that i could think of including:
But it just will not work for me at all!
Doesn't even want to run the project at all.
Please oh please smarter-people-than-I, how can I loop through all the rows in a DataTable or even a Datagrid if somebody found a simple way (looked at close to 30 pages and nobody seems to have found a way)?
Even if somebody managed to find a video tutorial (which I haven't), that would be awesome.
PS: I forgot to mention but I also added the Load Data segment in the code prior to the foreach statement written above.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!