Link to home
Start Free TrialLog in
Avatar of netravel
netravel

asked on

getting text from a row in a datagrid

I have a datagrid that has the first column as a boolean checkbox and the other 5 columns are textbox controls. The user will click the check box for their selection and then I want to get the values of each text box in that row to display on the next form, so I want to populate some variables to pass. How do I achieve this?

ASKER CERTIFIED SOLUTION
Avatar of 123654789987
123654789987

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hans Langer
Hans Langer

Hi,
Try This,
On the event click of the colmen checkbox use this to get the other values,


Dim Field1, Field2, Field3, Field4, Field5 As String
Field1 = Convert.ToString(DataGrid1.Item(0, DataGrid1.CurrentRowIndex))
Field2 = Convert.ToString(DataGrid1.Item(1, DataGrid1.CurrentRowIndex))
Field3 = Convert.ToString(DataGrid1.Item(2, DataGrid1.CurrentRowIndex))
Field4 = Convert.ToString(DataGrid1.Item(3, DataGrid1.CurrentRowIndex))
Field5 = Convert.ToString(DataGrid1.Item(4, DataGrid1.CurrentRowIndex))

GL
Sorry, a little mistake :P

Try This

Dim Field1, Field2, Field3, Field4, Field5 As String
Field1 = Convert.ToString(DataGrid1.Item(DataGrid1.CurrentRowIndex,0))
Field2 = Convert.ToString(DataGrid1.Item(DataGrid1.CurrentRowIndex,1))
Field3 = Convert.ToString(DataGrid1.Item(DataGrid1.CurrentRowIndex,2))
Field4 = Convert.ToString(DataGrid1.Item(DataGrid1.CurrentRowIndex,3))
Field5 = Convert.ToString(DataGrid1.Item( DataGrid1.CurrentRowIndex,4))

GL