Serial Port with ASP.net

Joined
Nov 13, 2006
Messages
3
Reaction score
0
I have a web page that use the IO.Ports.SerialPort object
I can write data and receive data from the serial port.

I want to change the label text when I received data from the serial port.
I raised an event from the class but the label text doesn't change

Here's the code

code from the class containing the SerialPort object:

Private Sub varSerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles varSerialPort.DataReceived
Dim varTime As Date
varTime = Now
If varSerialPort.BytesToRead < 16 Then
Exit Sub
End If
Do While DateDiff(DateInterval.Second, varTime, Now) < 0.5

Loop
ReDim varArrayfromController(varSerialPort.BytesToRead)
varSerialPort.Read(varArrayfromController, 0, varSerialPort.BytesToRead)

SendDataToSender()
RaiseEvent DataReceivedPort("Controller responded")


Here's the code from the page using the class object:

Protected Sub varPortClass_DataReceivedPort(ByRef xMessage As String) Handles varPortClass.DataReceivedPort

varPortClass.ClosePort()

lblInfo.Text = xMessage
Me.txtToSend.Text = xMessage

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top