|
-
Oct 3rd, 2007, 05:19 AM
#1
Thread Starter
Lively Member
Array Control
Hello!
Some small example how to create an Array of controls with its events and properties, example: TextBox, in runtime?
It is for VB.NET Compact Framework
Thank you :-)
-
Oct 3rd, 2007, 06:15 AM
#2
Frenzied Member
Re: Array Control
Hi,
try something like
Code:
Dim ict As Integer
Dim txtArr(5) As TextBox
For ict = 0 To 5
txtArr(ict) = New TextBox
txtArr(ict).Text = "Box " & ict
txtArr(ict).Tag = "Box" & ict
txtArr(ict).Size = New System.Drawing.Size(100, 30)
txtArr(ict).Location = New System.Drawing.Point(20, ict * 40)
txtArr(ict).Visible = True
Me.Controls.Add(txtArr(ict))
Next
Pete
-
Oct 3rd, 2007, 11:11 AM
#3
Thread Starter
Lively Member
Re: Array Control
 Originally Posted by petevick
Hi,
try something like
Code:
Dim ict As Integer
Dim txtArr(5) As TextBox
For ict = 0 To 5
txtArr(ict) = New TextBox
txtArr(ict).Text = "Box " & ict
txtArr(ict).Tag = "Box" & ict
txtArr(ict).Size = New System.Drawing.Size(100, 30)
txtArr(ict).Location = New System.Drawing.Point(20, ict * 40)
txtArr(ict).Visible = True
Me.Controls.Add(txtArr(ict))
Next
Pete
Very good!
and events? example Click, GotFocus, LostFocus...
Thank you Pete
-
Oct 3rd, 2007, 01:34 PM
#4
Frenzied Member
Re: Array Control
Hi,
Code:
AddHandler txtArr(ict).GotFocus, AddressOf txtArr_GotFocus
...
Private Sub txtArr_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
...
End Sub
Not Tested
Try it and see
-
Oct 3rd, 2007, 06:47 PM
#5
Re: Array Control
You can have the same handler handle the events for several different controls, so you don't necessarily have to make different functions for each control.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|