kyle_baker
01-23-2004, 01:40 PM
hey, i am creating a chat program, and i have programmed my program so that when you double click on an online user, it while on an im window by setting IMWindow1 = new IMWindow so it will open multiple times with the same form, now this is working fine, but when the user recieves a message i cannot find a way to direct the incoming message to the text box located on the right im window. I have also created a form that contains a listbox and everytime an im is opened or closed it is added or removed from the list, this is for me the be able to make my program keep track of the imwindows and not open multiples of the same users.
the code for when the user opens an im to a person themselves is...
Private Sub tContacts_DblClick()
Dim sContact As Integer
Dim IMWindow1 As IMWindow
Dim i As Integer
sContact = tContacts.SelectedItem.Index
For i = 0 To CurrentIMWindows.List.ListCount - 1
If CurrentIMWindows.List.List(i) = tContacts.Nodes.Item(sContact) Then
Exit Sub
End If
Next i
Set IMWindow1 = New IMWindow
CurrentIMWindows.List.AddItem (tContacts.Nodes.Item(sContact))
IMWindow1.Visible = True
IMWindow1.Caption = tContacts.Nodes.Item(sContact)
IMWindow1.Contact.Caption = tContacts.Nodes.Item(sContact)
End Sub
so... what i need to be able to do is use the following code when text is recieved and make it react like...
Dim i As Integer
Dim strSourceUser As String
strSourceUser = strIncomingUser.Text
For i = 0 To CurrentIMWindows.List.ListCount - 1
If CurrentIMWindows.List.List(i) = strSourceUser Then
'Here is where i need the code to say
'(IMWindow1 Matching Criteria).Visible = true
'(IMWindow1 Matching Criteria).txtMsgLog.Text = (IMWindow1 Matching Criteria).txtMsgLog & ": " & strMessage
End If
Next i
...thats what i need, and i know some one can do it cause i've asked some questions i thought were impossible and then someone gives a really simple peice of code that i knew but didn't think about, so thanks in advance for your help!
the code for when the user opens an im to a person themselves is...
Private Sub tContacts_DblClick()
Dim sContact As Integer
Dim IMWindow1 As IMWindow
Dim i As Integer
sContact = tContacts.SelectedItem.Index
For i = 0 To CurrentIMWindows.List.ListCount - 1
If CurrentIMWindows.List.List(i) = tContacts.Nodes.Item(sContact) Then
Exit Sub
End If
Next i
Set IMWindow1 = New IMWindow
CurrentIMWindows.List.AddItem (tContacts.Nodes.Item(sContact))
IMWindow1.Visible = True
IMWindow1.Caption = tContacts.Nodes.Item(sContact)
IMWindow1.Contact.Caption = tContacts.Nodes.Item(sContact)
End Sub
so... what i need to be able to do is use the following code when text is recieved and make it react like...
Dim i As Integer
Dim strSourceUser As String
strSourceUser = strIncomingUser.Text
For i = 0 To CurrentIMWindows.List.ListCount - 1
If CurrentIMWindows.List.List(i) = strSourceUser Then
'Here is where i need the code to say
'(IMWindow1 Matching Criteria).Visible = true
'(IMWindow1 Matching Criteria).txtMsgLog.Text = (IMWindow1 Matching Criteria).txtMsgLog & ": " & strMessage
End If
Next i
...thats what i need, and i know some one can do it cause i've asked some questions i thought were impossible and then someone gives a really simple peice of code that i knew but didn't think about, so thanks in advance for your help!