I have a form called Chatbox that i use for each contact that is clicked.
I do this with following code:
Dim ChatBoxWindow As New Chatbox
labelhandlename = DirectCast(sender, Label).Name
ChatBoxWindow.Name = labelhandlename
Chat_WindowList.Add(ChatBoxWindow)
ChatBoxWindow.Show()
What i want to do is check ---
Sub Chatbox(sender As System.Object, e As System.EventArgs)
labelhandlename = DirectCast(sender, Label).Name
Dim thisOne = Chat_WindowList.FirstOrDefault(Function(x) x.Name = labelhandlename)
If Chatbox.name = labelhandlename Then
thisOne.Focus()
Else
Dim ChatBoxWindow As New Chatbox
ChatBoxWindow.Name = labelhandlename
Chat_WindowList.Add(ChatBoxWindow)
ChatBoxWindow.Show()
End If
End Sub
Whats the best way to do this? (note: chatbox.name doesn't work)