i have a datagrid and i am not sure which event to use or how to use it. I want a situation whereby a user clicks or selects an item and it shows in a textbox then i have a button that will delete that item from the database
from datagrid to textbox
Page 1 of 12 Replies - 5532 Views - Last Post: 29 November 2012 - 03:46 AM
Replies To: from datagrid to textbox
#2
Re: from datagrid to textbox
Posted 29 November 2012 - 02:11 AM
Hi,
Use simple DataGridView click event. and use following code
where i is the index of column of data grid view or the cell which you want to show in TextBox1.
Hope will work...
Use simple DataGridView click event. and use following code
TextBox1.Text= DataGridView1.SlectedRows(o).Item(i).ToString
where i is the index of column of data grid view or the cell which you want to show in TextBox1.
Hope will work...
#3
Re: from datagrid to textbox
Posted 29 November 2012 - 03:46 AM
If e.ColumnIndex > -1 And e.RowIndex > -1 Then TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value End If
Write above code in DataGridView CellClick Event.
Page 1 of 1