I\'m using Visual Studio 2010 with C#. Is there a concept in Windows Forms development of somehow linking a label with is text box? Something so that they move together as
You can use extension methods to do it, follow example:
Private associatedLabels As New Dictionary(Of Control, Label)
Public Sub AssociateLabel(ByVal control As Control, ByVal label As Label)
If (Not associatedLabels.ContainsKey(control)) Then
associatedLabels.Add(control, label)
End If
End Sub
Public Function GetAssociatedLabel(ByVal control As Control) As Label
If (associatedLabels.ContainsKey(control)) Then
Return associatedLabels(control)
Else
Throw New Exception("There is no associated label")
End If
End Function