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 :-)
Printable View
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 :-)
Hi,
try something like
PeteCode: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
Very good!Quote:
Originally Posted by petevick
and events? example Click, GotFocus, LostFocus...
Thank you Pete :)
Hi,
Not TestedCode:AddHandler txtArr(ict).GotFocus, AddressOf txtArr_GotFocus
...
Private Sub txtArr_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
...
End Sub
Try it and see
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.