Click here to Skip to main content
15,790,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the Windows From application . I have a Datagridview. In that gridview, i bind some values using database..
Now if i click that bind value in the gridview that value is displayed in the particular Textbox.

How i do it.

Thanks in advance.
Updated 5-Nov-11 2:40am

I think you want to bind value of some database column to text box as soon as you bind to Grid View, if it is so, this will be helpful.[^]
Share this answer
Means on GridView cell click you want to fill that value to database. Right ?

after binding gridview successfully. Generate cell click event.

private void dataGridView1_CellClick(object sender,DataGridViewCellEventArgs e)
   DataGridViewImageCell cell = (DataGridViewImageCell)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
   txtTextbox.text = cell.value; 

Share this answer
RaisKazi 5-Nov-11 7:46am    
My 5!
koolprasad2003 5-Nov-11 8:47am    

use it in DataGridView Cell Click Event. When You click particular cell. It will fire and set the TextBox with value coming from Database.
Hope it helps...Happy Coding...:-)
Share this answer
Using DataGridView.CellClick Event.

Have a look at below link for more information.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900