1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Programically added new form with button - Click even't doesn't see textbox

Discussion in 'Visual Basic .NET' started by simpleonline1234, Jun 26, 2012.

  1. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    169
    Likes Received:
    13
    I have created my new window, textbox, and button and I can have my button display a messagebox.show("Hello") when I set the code under the click event.

    My Window has a button and a textbox.

    My issue is when I try to reference my new window's textbox in the code under that click event that I get an error message stating my new window is not declared.

    How do you get around that? The code is going to create the new window, the button, and the textbox and then I am trying to have the coded added to the button at runtime but because it doesn't exist yet it's firing an error when I try to build it.

    I tried adding the addeventhandler after the windows was created in the code but still a no go.
     
  2. theMagicNumber

    theMagicNumber Regular Member

    Joined:
    May 13, 2010
    Messages:
    345
    Likes Received:
    195
    Send the code i will help you with that.