Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. create new textbox

create new textbox

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GaryKoh
    wrote on last edited by
    #1

    hello i wish to do a function where with the press of a button new textbox will be created the more the user press the button the more textbox will be created can this function be done? can kindly guide me at this? thank yuo in advance Gary

    C 1 Reply Last reply
    0
    • G GaryKoh

      hello i wish to do a function where with the press of a button new textbox will be created the more the user press the button the more textbox will be created can this function be done? can kindly guide me at this? thank yuo in advance Gary

      C Offline
      C Offline
      carlos_rocha
      wrote on last edited by
      #2

      Hi! In the button's handle declare a new textbox(withevents if you want or add the handlers you desire), initialize it and finally add the Control to the Form, or else the button won't show up. Never say never

      G 1 Reply Last reply
      0
      • C carlos_rocha

        Hi! In the button's handle declare a new textbox(withevents if you want or add the handlers you desire), initialize it and finally add the Control to the Form, or else the button won't show up. Never say never

        G Offline
        G Offline
        GaryKoh
        wrote on last edited by
        #3

        dear carlos, thank you for ur reply but i dont quite understand what you mean can you please explain a little more detail? sorry and thank you Gary

        C 1 Reply Last reply
        0
        • G GaryKoh

          dear carlos, thank you for ur reply but i dont quite understand what you mean can you please explain a little more detail? sorry and thank you Gary

          C Offline
          C Offline
          carlos_rocha
          wrote on last edited by
          #4

          Ok.sorry.I was on a hurry, i was leaving for my lunch hour :P In the handler of the button you need to declare a new textBox object and do all the stuff i wrote.Here's a simple case: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click dim myTextBox as New TextBox myTextBox.Location = (...) myTextBox.Size = (...) 'If you need handlers AddHandler myTextBox.(...), AddressOf myHandlerFunction Me.Controls.Add(myTextBox) (...) End Sub That's it then you can access the textBox through the Controls collection (Me.Controls(x)).If you would like to access the textbox in another way, and because you create them dinamically, maybe you should keep them in an arrayList or hashTable. Sorry for the last post, i really hope i was clear this time.If not, ask again. Never say never

          G 1 Reply Last reply
          0
          • C carlos_rocha

            Ok.sorry.I was on a hurry, i was leaving for my lunch hour :P In the handler of the button you need to declare a new textBox object and do all the stuff i wrote.Here's a simple case: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click dim myTextBox as New TextBox myTextBox.Location = (...) myTextBox.Size = (...) 'If you need handlers AddHandler myTextBox.(...), AddressOf myHandlerFunction Me.Controls.Add(myTextBox) (...) End Sub That's it then you can access the textBox through the Controls collection (Me.Controls(x)).If you would like to access the textbox in another way, and because you create them dinamically, maybe you should keep them in an arrayList or hashTable. Sorry for the last post, i really hope i was clear this time.If not, ask again. Never say never

            G Offline
            G Offline
            GaryKoh
            wrote on last edited by
            #5

            thank you carlos this is very clear thank you for your guide and help Gary

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups