create new textbox
-
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
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
-
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
-
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
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
-
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