Looping Though A DataGridView?
-
Hey Guys, i have a dataGridView control on my form with only one column of type string. Now i need to get all the strings out of it one by one... how would i do that cuz it cant foreach thanx
Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS
you.suck = (you.passion != Programming)
-
Hey Guys, i have a dataGridView control on my form with only one column of type string. Now i need to get all the strings out of it one by one... how would i do that cuz it cant foreach thanx
Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS
you.suck = (you.passion != Programming)
for(int i = 0; i < dataGridView.Rows.Count; i++) {
Console.WriteLine(dataGridView.Rows[i][0]); }I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
-
Hey Guys, i have a dataGridView control on my form with only one column of type string. Now i need to get all the strings out of it one by one... how would i do that cuz it cant foreach thanx
Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS
you.suck = (you.passion != Programming)
Hi, Here is the code for foreach DataGridView grvCompany = new ....; foreach (DataGridViewRow row in grvCompany.Rows) { // } Thanks! Charith
jayasshc
-
for(int i = 0; i < dataGridView.Rows.Count; i++) {
Console.WriteLine(dataGridView.Rows[i][0]); }I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
Hey, thanx for the reply... that was the logical sollution for me too, but it doesnt allow the 2nd index (the one for the column) i tried these and they did not work
foreach (DataGridViewRow row in pollTimesDataGridView) { string myString = row[0]; MessageBox.Show(myString); } for (int i = 0; i < pollTimesDataGridView.Rows.Count; i++) { MessageBox.Show(pollTimesDataGridView.Rows[i][0]); }
any ideas? thanx justinHarvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS
you.suck = (you.passion != Programming)