vb.net - Serial Port read timed out visual basic -
i need read serial port parse incoming strings. if use putty
can read strings in serial port if use vb application code, doesn't work:
private sub comportlist_selectedindexchanged(sender object, e eventargs) handles comportlist.selectedindexchanged dim com1 io.ports.serialport = nothing try com1 = my.computer.ports.openserialport(comportlist.selecteditem, 9600) com1.readtimeout = 10000 dim incoming string = com1.readline() if incoming isnot nothing msgbox(incoming & vbcrlf) end if loop catch ex timeoutexception msgbox("error: 'serial port read timed out.'") ' getting error if com1 isnot nothing com1.close() end try end sub
i getting read time out error. code based on msdn documentation.
thanks in advance.
Comments
Post a Comment