VB .NET Form, Call Thread with Arguments and Invoke



Hi,

I'm developing a Windows form application, with multithreading and my
problem is this:

When i receive any data begining by "1", i need to create a thread
calling the sub "EscribirChat" with one argument.

This is the code that i have now:

Delegate Sub AñadirTextoChatCallBack(ByVal Texto As String)

Private ThreadChat As Thread = Nothing

Private Sub DatosRecibidosServer(ByVal Datos As String)
Select Case Datos.Chars(0)
Case "0" : OperacionInterna(Datos)
Case "1"
Me.ThreadChat = New Thread(AddressOf
Me.EscribirChat)
Me.ThreadChat.Start()
End Select
End Sub

Private Sub EscribirChat(ByVal Texto As String)
Me.AñadirTextoChat(Texto)
End Sub

Private Sub AñadirTextoChat(ByVal Texto As String)
If Me.TBSalidaChat.InvokeRequired Then
Dim d As New AñadirTextoChatCallBack(AddressOf
AñadirTextoChat)
Me.Invoke(d, New Object() {Texto})
Else
OperacionChat(Texto)
End If
End Sub

Private Sub OperacionChat(ByVal Datos As String)
Dim Tam As Integer = Convert.ToInt16(Datos.Substring(2,
3))
Dim Cadena As String

Cadena = Datos.Substring(6, Tam)
Me.TBSalidaChat.Text = Me.TBSalidaChat.Text & "<" &
Me.NombreOponente & "> : " & Cadena & vbCrLf
Me.TBSalidaChat.Select(Me.TBSalidaChat.Text.Length, 0)
Me.TBSalidaChat.ScrollToCaret()
End Sub


And Microsoft Visual Studio 2003 tell me:

"Method 'Private Sub EscribirChat(ByVal Texto As String)' does not
have the same signature as delegate 'Delegate Sub ThreadStart()'"

Can someone help me for solve this problem?.

Thank you very much.

Javi.

.



Relevant Pages

  • Re: Playing an AVI video
    ... You'd use the "window avi handle" MCI command string. ... Dim mlRet As Long ... Private Sub CenterObject ...
    (microsoft.public.vb.general.discussion)
  • Re: Multi-image Bitmap Extraction
    ... Private Sub Form_Load ... cFileName As String * MAX_PATH ... Dim WFD As WIN32_FIND_DATA, hFile As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Working Transactions somehow started not to work
    ... ÖA> Private Sub Form_Open ... ÖA> Dim strSqlMain As String ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Custom textbox in Userform
    ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... Function IsValid(strText As String) As Boolean ...
    (microsoft.public.excel.programming)
  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)

Loading