Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: |
Dim Labels() As Label
Sub AddMoreLabels(ByVal NewX As Integer, ByVal NewY As Integer)
Try
If Labels Is Nothing Then
Labels(0) = New Label
Me.Controls.Add(Labels(UBound(Labels) - 1))
AddHandler Labels(UBound(Labels) - 1).Click, AddressOf Labels_Click
Labels(UBound(Labels) - 1).Name = "Lbl(" & UBound(Labels) - 1 & ")"
Labels(UBound(Labels) - 1).Location = New System.Drawing.Point(NewX, NewY)
Else
ReDim Preserve Labels(UBound(Labels))
Labels(UBound(Labels) - 1) = New Label
Me.Controls.Add(Labels(UBound(Labels) - 1))
AddHandler Labels(UBound(Labels) - 1).Click, AddressOf Labels_Click
Labels(UBound(Labels) - 1).Name = "Lbl(" & UBound(Labels) - 1 & ")"
Labels(UBound(Labels) - 1).Location = New System.Drawing.Point(NewX, NewY)
Labels(UBound(Labels) - 1).Visible = True
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Labels_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'See below for GetIndex code.
MsgBox("Hello there from: " & GetIndex(Sender))
End Sub
'This function returns the "Index" of an array. Ie. If Sender is Lbl(5) it
'will return 5 (See Labels_Click for Example)
Function GetIndex(ByVal Sender As System.Object) As Integer
'I used "Pos" and "Name just to enhance readability
Dim Name As String = DirectCast(Sender, Control).Name
Dim Pos As Integer = InStr(1, Name, "(") + 1
Return CInt(Mid(Name, Pos, Len(Name) - Pos))
End Function
|
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |