gibea00
September 17th, 2002, 09:05 AM
Hi
I would like to know how to put the data in the dbgrid in some text box. I want to be able to click on a row and the data in each cell will appear in their textbox.
How can i do that ?
thanks a lot
Tower
September 18th, 2002, 11:23 PM
For example, you have three text box and data grid with three column
See this code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler DataGrid1.CurrentCellChanged, AddressOf Grid_CurCellChange
End Sub
Protected Sub Grid_CurCellChange(ByVal sender As Object, ByVal e As EventArgs)
TextBox1.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 0).ToString()
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 1).ToString()
TextBox3.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 2).ToString()
End Sub
This code fill data from column 1 to texbox1, from column 2 to textbox2 and from column 3 to textbox3