how to bind textbox to dataviewgrid
-
hi... could someone tell me the codes for this scenario.. if i click on the datagridview for example username if i click that username that username will appear in a label or textbox... thanks...
-
you heard something called CellClick even. Then just get the value of selected cell and giv it to the Text property of your control(Label, TextBox ...) And don't ask your question twice!!!
Strahil Shorgov
-
sory for asking twice... i know what your saying but i dont know how to get the value of the selected cell... can you tell me...
-
Try the CellEnter event:
void dataGridView_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (((DataGridView)sender)[e.ColumnIndex, e.RowIndex].Value != System.DBNull.Value)
Textbox.Text = ((DataGridView)sender)[e.ColumnIndex, e.RowIndex].Value.ToString();}
Kjetil