|
-
Jun 26th, 2002, 04:28 AM
#1
Thread Starter
Lively Member
Label.Index, Where did it go????
I wanted to use multible lables with the index option
like in VB6, but the label doesn't have that property.
What is the best way to do somethin like that?
Code:
Form_Load
For I=0 To lblTest.Ubound
lblTest(I).Caption="Test" & I"
Next I
For I=0 To lblTest2.Ubound
lblTest2(I).Caption="Another" & I
Next I
-
Jun 26th, 2002, 07:49 AM
#2
yay gay
Indexes are not suported in VB.NET
-
Jun 26th, 2002, 07:55 AM
#3
New Member
Load the lables on run-time as an array of lables.
By doing do, you will be able to set label properties, add events which will be fired by each one of the lables and more.
For example:
'Put the following in the form load event:
Dim i As Integer
Dim Cb As CheckBox
Lst = New Collection()
For i = 0 To 9
Cb = New CheckBox()
Cb.Text = "Line #" & i + 1
Cb.Top = 10 + (Cb.Height) * i
Cb.Left = 5
Cb.Name = "Test" & i
Lst.Add(Cb)
Me.Controls.Add(Cb)
AddHandler Cb.CheckedChanged, AddressOf CheckBoxLine_CheckedChanged
AddHandler Cb.Click, AddressOf CheckBoxLine_Click
Next i
'The code for the events:
Private Sub CheckBoxLine_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Cb As CheckBox
Cb = CType(sender, CheckBox)
Me.Text = Cb.Name
End Sub
Private Sub CheckBoxLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Cb As CheckBox
Cb = CType(sender, CheckBox)
Me.Text = Cb.Name
End Sub
Have fun.
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
|