Carrying a value from one form to the next to display information from a table

I have a form that has a value from a table on it and I am trying to carry that value over to a new form to display more information. I know that I probably need to do something with classes but I am so new at this that I don't totally understand classes. If there is anyone out there that can help me out or guide me in the right direction I would appreciate it. I have read a lot on classes but haven't seen or read anything that I think would fit my situation. Doing this is going to be the heart of my software so I really need to figure it out.

Thanks in advance for any help!




Answer this question

Carrying a value from one form to the next to display information from a table

  • orent

    If you have textbox.text in Form1 and you want to display it in Form2, you should reference Form1 textbox in Form2....

    Example: In Form2 type Form1.textbox.text


  • logtorahul

    how did you get it to work

  • Mirai

    to pass objects (items) from one form to the other, check this out:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=760400&SiteID=1

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=700821&SiteID=1

    Same thing applies for the textbox, you just need to change the variable names and what not and do your thing



  • 48050

    YIPPEE!! Got it working. Thanks so much for everyone's help!! Now I am hassling with my Debugger. Guess I have to start another thread.

  • andris11

    In Form2 create a button..doubleclick it and code it....

    MessageBox.Show(Form1.textbox.text).....see what you get.


  • zackasan

    In my code I have on load of form2 code to query the information from the table useing the form1.textbox.text as the value. It is almost like it is clearing out the value from my textbox but when I exit form2 and go back to form1 the value is still on that form. I am not sure how to check to make sure this is or isn't the case.

  • Carrying a value from one form to the next to display information from a table