-
July 28th, 2003, 08:17 AM
#1
How to retrieve columnname in a datagrid?
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?
-
July 28th, 2003, 09:02 AM
#2
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)
Back after a long hibernation.
-
July 28th, 2003, 09:06 AM
#3
Okay, thanks.
But my dataset contains several tables.
How can I figure out which table the current cell is in?
-
July 28th, 2003, 09:09 AM
#4
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)
Back after a long hibernation.
-
July 28th, 2003, 09:12 AM
#5
Thanks again, but how can I figure out the selected table in the dataset.
-
July 28th, 2003, 09:30 AM
#6
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)
Back after a long hibernation.
-
July 29th, 2003, 01:32 AM
#7
Thanks again.
That was just wat I needed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|