We help IT Professionals succeed at work.

Retreive values from row in Datagrid

rajender123 asked
Medium Priority
Last Modified: 2010-05-01
I have one datagrid  and   textboxes namely student name, student Id and student add, student visit date.
Now   the user say enters either of the value in text boxes.............
based on that, i am  displaying the search in datagrid...
Now i want that when the user  selects any of the rows from datagrid , the values   will be displayed in the text boxes ( as i have mentioned  above)

 and  at the same  the search results remain in the  datagrid.. since this provides the user that he can select any other rows also......

Please  tell  me  in VB urgently
Watch Question

display thecontent of datagrid values to text box
text1.text= datagrid1.columns(0).text
text2.text= datagrid1.columns(1).text


Thanks  abdul...
but if th value is null in the datagrid it is showing the Type mismatch error...
how will i  get that value  that this is null/../..
how will i retreive that value..

please let me know
ok you can put on error resume next

private sub B1_click ()
on error resume next
text1.text= datagrid1.columns(0).text
text2.text= datagrid1.columns(1).text
end sub
so you can put the error resume on the top of sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Thanks my problem is solved now...
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.