To simplify.....lets say i have a chat program....A wierd one.
This chat program has multiple clients, and 1 host. the clisnt side is good and easy to program. but the host is mean and evil. The host is an MDI and each time a client logs on a new instance of a chat form pops up. So if there are 4 clients, then the host has 4 client forms open simultaneously. They are declared and opened like this:
<Code>
Dim frmClient(8) As New frmClients
Public nClientCount As Integer
Public Sub LoadNewClient(clientLoginName As String, clientCharName As String)
If nClientCount < 8 Then
frmClient(nClientCount).Caption = clientLoginName & " - " & clientCharName
frmClient(nClientCount).Show
frmClient(nClientCount).Move 0, nClientCount * frmClient(nClientCount).Height
frmClient(nClientCount).Tag = nClientCount
nClientCount = nClientCount + 1
Else
MsgBox "No more Clients can be added at this time"
End If
End Sub
</code>
And on that form (frmClient(X)), the "send chat message" button looks like this:
<code>
Private Sub cmdSend_Click()
frmMain.WinsockClient(Me.Index).SendData "T" & Me.txtSend.Text
End Sub
</code>
The reason I have the "Me.Index" in there is because all the data is being routed through an array of winsock controls that are located on the frmMDIMain form.
And it does not work. When compileing the following error occurs:
"Method or Data Member not found"
I know this is because if its not runtime, there is no Index property on frmClient(). So I suppose my question is...
How do I "link" the SendData on an instance of a MDI child form (an array of forms) to the appropriate index number of my winsock control array?
I thought I could just Link the two 'indexes' because the index of the "chat form" will always match the index of the winsock control that it has to send its data to...but I cant seem to get it to co-operate. Help!
This chat program has multiple clients, and 1 host. the clisnt side is good and easy to program. but the host is mean and evil. The host is an MDI and each time a client logs on a new instance of a chat form pops up. So if there are 4 clients, then the host has 4 client forms open simultaneously. They are declared and opened like this:
<Code>
Dim frmClient(8) As New frmClients
Public nClientCount As Integer
Public Sub LoadNewClient(clientLoginName As String, clientCharName As String)
If nClientCount < 8 Then
frmClient(nClientCount).Caption = clientLoginName & " - " & clientCharName
frmClient(nClientCount).Show
frmClient(nClientCount).Move 0, nClientCount * frmClient(nClientCount).Height
frmClient(nClientCount).Tag = nClientCount
nClientCount = nClientCount + 1
Else
MsgBox "No more Clients can be added at this time"
End If
End Sub
</code>
And on that form (frmClient(X)), the "send chat message" button looks like this:
<code>
Private Sub cmdSend_Click()
frmMain.WinsockClient(Me.Index).SendData "T" & Me.txtSend.Text
End Sub
</code>
The reason I have the "Me.Index" in there is because all the data is being routed through an array of winsock controls that are located on the frmMDIMain form.
And it does not work. When compileing the following error occurs:
"Method or Data Member not found"
I know this is because if its not runtime, there is no Index property on frmClient(). So I suppose my question is...
How do I "link" the SendData on an instance of a MDI child form (an array of forms) to the appropriate index number of my winsock control array?
I thought I could just Link the two 'indexes' because the index of the "chat form" will always match the index of the winsock control that it has to send its data to...but I cant seem to get it to co-operate. Help!