locked
Can not run application on other pc RRS feed

  • Question

  • I am trying to create a small program with the winsock control in Visual Basic .net 2005

    Earlier i have managed to do this easy with Visual basic 6 but with .net i get a error i dont understand at all.

    The Error is shown in when i try to run or install the application i have written. The error just ask's if i want to send error report or not. In Event Viewer i can see the error, and it says: EventType clr20r3, P1 client.exe, P2 1.0.0.0, P3 483bd8c, P4 client, P5 1.0.0.0, P6 4835bd8c, P7 d, P8 c6,P9 system.invalidoperationexception, P10 NIL

    The error only shows on other computers. On the computer where it is compiled it runs smooth.
    The computer im testing on is clean Windows XP all updates and .net  runtime 2.0

    This is the simple code im trying to run.

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            sock.RemotePort = 2909
            sock.RemoteHost = sock.LocalIP  ' Or localhost

            sock.Connect()
        End Sub

        Private Sub Sock_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles sock.DataArrival
            Dim A As Object
            A = ""
            Dim NewString As String
            NewString = ""
            Dim Character As Byte

            sock.GetData(A)

            For Each Character In A
                NewString = String.Concat(NewString, Chr(Character))
            Next

            TextBox1.Text = String.Concat(NewString, vbNewLine, TextBox1.Text)

        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            sock.SendData(TextBox2.Text)
            TextBox1.Text = String.Concat(TextBox2.Text, vbNewLine & TextBox1.Text)
            TextBox2.Text = ""
        End Sub

    I do use winsock as reference and the winsock library is located in the same folder as the .exe file im trying to run.

    I have no idea why this error occurs. And why it only occurs on other pc then the one it is compiled on.

    Thursday, May 22, 2008 7:11 PM

Answers

  • you may need to register the control, im not sure. but is there a reason why you have to use the winsock control? What are you trying to do?

     

    Thursday, May 22, 2008 8:09 PM

All replies

  • are you able to place a try catch block around bits of code and then catch the exception and show the error on the screen via MessageBox? InvalidOperationException appears to be happening but need to know where and why

     

    Thursday, May 22, 2008 7:13 PM
  • I know what causes it. If i put the winsock control in a empty windows application and compiles it. Then it wont run on other computers. Does someone knows why ?

    Thursday, May 22, 2008 7:39 PM
  • you may need to register the control, im not sure. but is there a reason why you have to use the winsock control? What are you trying to do?

     

    Thursday, May 22, 2008 8:09 PM