Phreak
Well-known member
Ok.
How do I use an object created in a DLL in my form.
For instance, I have Class Library named PB and a class named Comm. Now, I have a sub that creates a TCPClient in my Comm class.
In my form class I create a new object of Comm. And run the method to create the TCPClient.
How do I reference that in my form?
Here is my class code:
In my form code I dimension and create a new PB.Comm object named Client. I then run the method CreateTCPClient in the OnLoad routine.
Any help on using that newly created objClient object in my form code? Or am I going about this the wrong way?
How do I use an object created in a DLL in my form.
For instance, I have Class Library named PB and a class named Comm. Now, I have a sub that creates a TCPClient in my Comm class.
In my form class I create a new object of Comm. And run the method to create the TCPClient.
How do I reference that in my form?
Here is my class code:
Code:
--------------------------------------------------------------------------------------
START GLOBAL DECLARATIONS
--------------------------------------------------------------------------------------
Const PORT_NUM As Int16 = 5000
Const READ_BUFFER_SIZE As Integer = 255
Public objClient As TcpClient
Public Delegate Sub DisplayInvoker(ByVal t As String)
--------------------------------------------------------------------------------------
END GLOBAL DECLARATIONS
--------------------------------------------------------------------------------------
Public Sub CreateTCPClient()
objClient = New TcpClient("localhost", PORT_NUM)
End Sub
Use a StreamWriter to send a message to server.
Private Sub SendData(ByVal data As String)
Dim writer As New IO.StreamWriter(objClient.GetStream)
writer.Write(data & vbCr)
writer.Flush()
End Sub
End Class
In my form code I dimension and create a new PB.Comm object named Client. I then run the method CreateTCPClient in the OnLoad routine.
Any help on using that newly created objClient object in my form code? Or am I going about this the wrong way?