marksquall
Active member
- Joined
- Oct 17, 2009
- Messages
- 28
- Programming Experience
- 3-5
Dear administrators and members,
Hello everyone, a plesant day.:welcoming:
I got this code somewhere on the Internet by accident. The code automatically creates ten (10) textboxes on run time upon loading the form.
Since I have created 10 TextBox objects with different names (and eventually 10 Label objects too), How can I create an only one event in all TextBox objects in which I will "collect" the text/string from the ten TexBox objects and maybe store each input in an array of String. I hope you could help me with this one.
Thank you and more power. :adoration:
Respectfully Yours,
MarkSquall
Hello everyone, a plesant day.:welcoming:
I got this code somewhere on the Internet by accident. The code automatically creates ten (10) textboxes on run time upon loading the form.
VB.NET:
[COLOR="#0000FF"]Private Sub[/COLOR] Main_Load([COLOR="#0000FF"]ByVal[/COLOR] sender [COLOR="#0000FF"]As[/COLOR] System.[COLOR="#0AEFD1"]Object[/COLOR], [COLOR="#0000FF"]ByVal[/COLOR] e [COLOR="#0000FF"]As[/COLOR] System.[COLOR="#0AEFD1"]EventArgs[/COLOR]) [COLOR="#0000FF"]Handles MyBase[/COLOR].Load
[COLOR="#0000FF"]Dim[/COLOR] i[COLOR="#0000FF"] As Integer[/COLOR]
[COLOR="#0000FF"] For[/COLOR] i = 1 [COLOR="#0000FF"]To[/COLOR] 10
[COLOR="#0000FF"]Dim[/COLOR] ansTxtBox1 [COLOR="#0000FF"]As New[/COLOR] [COLOR="#0AEFD1"]TextBox[/COLOR]()
[COLOR="#0000FF"]Dim[/COLOR] numLabel [COLOR="#0000FF"]As New[/COLOR] [COLOR="#0AEFD1"]Label[/COLOR]()
numLabel.Text = i & [COLOR="#B22222"]"."[/COLOR]
ansTxtBox1.Name = [COLOR="#B22222"]"TxtRead"[/COLOR] & i
ansTxtBox1.Size = [COLOR="#0000FF"]New[/COLOR] Drawing.[COLOR="#0AEFD1"]Size[/COLOR](40, 23)
[COLOR="#0000FF"] Me[/COLOR].FlowLayout.Controls.Add(numLabel)
[COLOR="#0000FF"]Me[/COLOR].FlowLayout.Controls.Add(ansTxtBox1)
[COLOR="#0000FF"] Next[/COLOR]
[COLOR="#0000FF"]End Sub[/COLOR]
Since I have created 10 TextBox objects with different names (and eventually 10 Label objects too), How can I create an only one event in all TextBox objects in which I will "collect" the text/string from the ten TexBox objects and maybe store each input in an array of String. I hope you could help me with this one.
Thank you and more power. :adoration:
Respectfully Yours,
MarkSquall
Last edited: