Click here to Skip to main content
15,904,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem with selecting a row in a datagridview. I want the user to press on the data rowheader of the data gridview then it must show in textbox particular strings
Posted
Updated 28-Mar-11 4:46am
v4
Comments
Wendelius 27-Mar-11 16:28pm    
No need to bold the whole text.
MarqW 28-Mar-11 3:01am    
Could you please clarify the question, what must show in the particular strings?
Sandeep Mewara 28-Mar-11 3:15am    
Not clear.
Buunee 28-Mar-11 8:05am    
it must show in text box . i manageed buttons . like next prev . last . first etc... but i want make it by mouse clicking . (Poster)
Buunee 28-Mar-11 8:06am    
if dont understand i will upload photo of it ,

1 solution

If you want to show the contents of the datagridview by clicking on any cell of the row. then Write this code in the CellContentClick() event of the datagridview


textbox1.text = datagridview1.Rows(e.RowIndex).Cells(0).Value
textbox2.text = datagridview1.Rows(e.RowIndex).Cells(1).Value
(etc)


If you want to show the contents of the datagridview by clicking the header of the row then write this code in the RowHeaderMouseClick event of the datagridview


textbox1.text = datagridview1.Rows(e.RowIndex).Cells(0).Value
textbox2.text = datagridview1.Rows(e.RowIndex).Cells(1).Value
(etc)


Note: textbox1 and textbox2 are only for example. Use your one fields here to get the datagridview contents.
 
Share this answer
 
v3

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