Results 1 to 4 of 4

Thread: Change textbox.Text from another form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458

    Change textbox.Text from another form

    Hi,
    I have 2 forms.
    frmMain is the startup form, it has a button and a textbox. The button loads & shows frmCustomer (so now frmCustomer is on top of frmMain)

    Now from frmCustomer I want to change contents of textbox on frmMain.

    Is it possible?
    Thanks

    Tomexx.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Change textbox.Text from another form

    Congratulations! You're our 1 millionth customer to ask that question. Maybe that's an exaggeration but that question, or at least questions where the principle is accessing members of one form from another form, are possibly the most oftened asked on this forum. Forms are objects and they obey the same rules as all other objects in VB.NET. I suggest that you read the "Forms in VB.NET" tutorial in my signature.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458

    Re: Change textbox.Text from another form

    Sorry about that, but I couldn't come up with a good "search phrase" so I started a post where I could explain what I'm after.

    I'll read your tutorial, however for the time you spent writing your response, you could have just show me the line of code that I needed.
    Thanks

    Tomexx.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Change textbox.Text from another form

    What makes you think it would be just one line of code? Besides, learning by doing is always better than just copying and pasting, when people usually put their brain in neutral and often gain no real understanding of what the code does. Also, that tutorial contains a great deal of valuable information that will answer many questions besides the current one and should be required reading for all new Vb.NET developers. If you learn the principles then you can apply them to many similar situations. I'm a big fan of pointing people in the right direction and then encouraging them to use the information they find to work the problem out for themselves. It may take longer but you learn more and you also get better at problem solving, which means you're more able to solve your own problems in the future.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width