문제

Hey all i have this being called:

Public Sub doStuff(ByVal what2Do As String)
   Dim command As String = ""

   If Trim(lanSent(1)) = "turnOffPC" Then
       command = "r5"
   ElseIf Trim(lanSent(1)) = "TurnOnPC" Then
       command = "r3"
   End If

   Dim t As New Threading.Thread(AddressOf androidWS)

   t.SetApartmentState(Threading.ApartmentState.STA)
   t.Start()
End Sub


Private Shared Sub androidWS(ByVal command As String)
    Dim arduinoWebSite As New WebBrowser

    arduinoWebSite.Navigate("http://192.168.9.39:19/?r=" & command)
End Sub

And i am wondering how i can send a value to androidWS?

updated code that works

Public Sub doStuff(ByVal what2Do As String)
   Dim command As String = ""

   If Trim(lanSent(1)) = "turnOffPC" Then
       command = "r5"
   ElseIf Trim(lanSent(1)) = "TurnOnPC" Then
       command = "r3"
   End If

   Dim t As New Threading.Thread(AddressOf androidWS)

   t.SetApartmentState(Threading.ApartmentState.STA)
   t.Start(command)
End Sub


Private Shared Sub androidWS(ByVal command As Object)
    Dim arduinoWebSite As New WebBrowser

    arduinoWebSite.Navigate("http://192.168.9.39:19/?r=" & command)
End Sub
도움이 되었습니까?

해결책

You use the Thread.Start(Object) overload to pass data to your handler sub.

http://msdn.microsoft.com/en-us/library/6x4c42hc.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top