-
duplicate labels
I am new to .net on VB six if you copied and pasted for example label1 it would create label1(0) and label1(1). Not so in VB.net which is causing me a big headache.
I am creating a random number from 1-90 and if number 10 for example was the random number i am changing the contents of label10.text to "x".
I do this so that i can when generating the next random number say whever or not that number has already been drawn.
In VB6 i was able to say if Label1(RandomNumber).text="x" however in .net i have had to have a label1,abel2,label3 etc. and so the above code will not work. I hope this makes sense it should be fairly simple!!!!
-
Re: duplicate labels
Hi
Every form has a collection of controls...
Code:
Dim c As Control
For Each c In Me.Controls
If c.GetType.ToString = "System.Windows.Forms.Label" Then
Select Case c.Name
Case "Label1"
c.Text = "hello"
End Select
'' do something
End If
Next
Regards
Jorge