newbie: Navigating through a datagrid

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Hi,
I don't seem to find any direct methods of navigating in a datagrid after
it has been populated.
How would I use a double nested loop to navigate through all the rows and
columns and count or store the various cells?

Do I have to do it directly on the dataset that was used to bind the
datagrid?

Thanx in advance,
steve
 
Steve,
Do I have to do it directly on the dataset that was used to bind the
datagrid?
Exactly or better expressed using the datasource from the datagrid

Cor
 
Thanx Cor!
But what annoyes me is that i dont seem to be able to do:

For i As Integer = 0 To myDataSet.Tables("tblDisp").Rows.Count - 1

For j As Integer = 0 To myDataSet.Tables("tblDisp").Columns.Count - 1

myVariable= myDataSet.Tables("tblDisp").Columns(j).Rows(i).item <--wrong code !

Next

Next

or something like that !!!!!!

Why?????

All i want is to scan and navigate.... why should it be so difficult?
 
Steve


For i As Integer = 0 To myDataSet.Tables("tblDisp").Rows.Count - 1
For j As Integer = 0 To myDataSet.Tables("tblDisp").Columns.Count - 1
myVariable= myDataSet.Tables("tblDisp").Rows(i)(j).tostring
Next
Next

Why?????

Columns are to describe items not to reference to.

Items are to get the data.

When it does not work now than it is a typo.

I hope however that this helps direct?

Cor
 
Damn! I feel stupid!!!
But i swear i looked everywhere on MSDN and Google, couldn't find something
like that.
(i still feel Rows(i).Columns(j) is more intuitive but...thats me)
I know that most applications once they extract the data they just print
them or store them at Excel. But i would imagine many people would want to
store them in arrays and perform various statistics, etc. on them. Am I an
exception !??

Thanx a lot Cor!
You saved the day *again*!
-steve
 
Back
Top