Accessing Data in DataGrid

  • Thread starter Thread starter Bruce LeMond
  • Start date Start date
B

Bruce LeMond

I'm wanting to check a column in a datagrid and take some
action if it equals a certain value. I have the following
Code:

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DataGrid1.CurrentCellChanged
rows = DataGrid1.CurrentCell.RowNumber
cols = DataGrid1.CurrentCell.ColumnNumber
End Sub

And then I have the following if statement somewhere else
in the program:

If DataSet1.Tables("ItemsOrder").Rows(rows)("Class") = "S"
Then
DisplaySpecialClass()
End If

When I tried running it, I'm still not getting the data
from the datagrid row that I selected. What would I be
doing wrong?

Thanks in advance.
 
Hi,

Dim dgCell As DataGridCell

dgCell = DataGrid1.CurrentCell

MessageBox.Show(DataGrid1.Item(dgCell).ToString)


Ken
 
Back
Top