dcsimg
Results 1 to 2 of 2

Thread: VB 2010 - Getting Information from a Dynamically created textbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    1

    VB 2010 - Getting Information from a Dynamically created textbox

    Hi,

    On my form, A user can select a few chec box options, then clicks OK.
    A new tabpage with a textbox and two buttons is created and added to my form, the textbox can be seen as a sort of 'receipt', and one button is a close button, which deletes that tab, the other button is an edit button.
    When the user selects edit, I would like the selection page to open up, checking, (through a couple of If conditions, whether a text is contained in the text box), then if a certain text is found in the box, a corresponding checkbox on my form is checked.

    So basically, my problem is trying to check the text from a textbox which doesnt exist until after my form is loaded... I need someway to reference this new text box, not forgetting there may be many tabs at one stage.

    I tried a method in which each new texbox was added to a list, then when the edit button was clicked, it checked the tab index and checked the corresponding textbox, but this would only work for the first tab/textbox and caused issues with the close button, So what I am thinking, is if someone could help me find a way, perhaps when the edit button is pressed, VB checks my selected tab, and somehow finds the textbox which is on that tab.

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: VB 2010 - Getting Information from a Dynamically created textbox

    If you want to get the text of a dynamic textbox when it changes, use AddHandler to create an Event Handler link.

    If you want to get the text of a dynamic textbox at any other time, just loop through the .Controls collection of it's parent object.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width