When the selection is in a specific cell in the datagrid, I want to retrieve the column name.
I can not find the datagrid method to do this.
Can anyone help me?
Printable View
When the selection is in a specific cell in the datagrid, I want to retrieve the column name.
I can not find the datagrid method to do this.
Can anyone help me?
Here is one of the method that i know off:
ss = CType(DataGrid1.DataSource, DataSet).Tables(0).Columns(0).ToString
MsgBox(ss)
Or
Dim datast As New DataSet()
datast = DataGrid1.DataSource
MsgBox(datast.Tables(0).Columns(0).ColumnName.ToString)
Okay, thanks.
But my dataset contains several tables.
How can I figure out which table the current cell is in?
Oops... I forgot about "When the selection is in a specific cell in the datagrid" Here is the code
Dim ss As String
ss = CType(DataGrid1.DataSource, DataSet).Tables(0).Columns(DataGrid1.CurrentCell.ColumnNumber).ToString
MsgBox(ss)
Thanks again, but how can I figure out the selected table in the dataset.
Well this is the only way i know off:
Dim ss As String
ss = CType(DataGrid1.DataSource, DataSet).Tables(DataGrid1.DataMember).Columns(DataGrid1.CurrentCell.ColumnNumber).ToString
MsgBox(ss)
Thanks again.
That was just wat I needed.