Accessing data in a Data grid grid

Appu

New member
Joined
Oct 19, 2005
Messages
2
Programming Experience
Beginner
Hi everyone:

I'm trying to get values from a specific cell datagrid (dragged from vbnet toolbox), i loaded the datagrid with a datatable object and i want to get the value from the first cell of the selected row..... could anyone hep me please

Thanks in advance

Appu
 
Are you trying to get cell values by clicking in the datagrid? Or are you wishing to get the cell values by some other method?

If its by clicking around on the datagrid, you could use the _CurrentCellChanged event of the datagrid (Winform I am assuming) like this:

VB.NET:
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
        MessageBox.Show("Col is " & DataGrid1.CurrentCell.ColumnNumber _
      & ", Row is " & DataGrid1.CurrentCell.RowNumber _
      & ", Value is " & DataGrid1.Item(DataGrid1.CurrentCell))

    End Sub
HTH
Blokz
 
Back
Top