Here is the entire function:
VB Code:
  1. Public Function DoMsg(SenderNick, Msg)
  2. Dim MsgWindow() As frmMsg, i, User(), x
  3. i = UBound(MsgWindow) + 1 'Subscript Out Of Range?!
  4. ReDim Preserve MsgWindow(i)
  5. Set MsgWindow(i) = New frmMsg
  6. For x = 0 To UBound(MsgWindow) 'Object Variable or with block not set?!
  7. If MsgWindow(x).Caption = SenderNick Then
  8.     MsgWindow(x).txtRecieve.text = MsgWindow(x).txtRecieve.text & vbCrLf & "< & sendernick & " > " & msg"
  9.     Exit Function
  10. Else
  11.     MsgWindow(x).Show
  12.     MsgWindow(x).Caption = SenderNick
  13.     MsgWindow(x).txtRecieve.text = MsgWindow(i).txtRecieve.text & vbCrLf & "<" & SenderNick & " > " & Msg
  14.     Exit Function
  15. End If
  16. Next x
  17. End Function

The idea is that if a form is open with the caption the same as the SenderNick it will just add the text to that form. It doesnt even get that far...


Once again, thanks for all your help everyone. I really appreciate it!