Serial Comm Port
Serial Comm Port
Good afternoon) I'm trying to figure out the serial port. I would like to use only graphical ActiveX settings as in VB6. The task is simply to send the contents of textbox1 to the serial port when the button is pressed. Tell me the minimum possible program for this. The port has already been specified. It remains to understand the sequence and syntax. As I understand it, you do not need to open the port as in VB6.
- Attachments
-
- 1.png (54.21 KiB) Viewed 11529 times
- BruceSteers
- Posts: 1615
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Serial Comm Port
I have never used SerialPort control but it looks like it inherits Stream.class
I assume you have read all the help on the wiki...
SerialPort @ https://gambaswiki.org/wiki/comp/gb.net/serialport
Stream @ https://gambaswiki.org/wiki/comp/gb/stream
to write to a stream it is done something like this..
(I think the stream MUST be Opened before writing but i could be wrong.
But like i say i only assume this is how serialport works as i do not have anything to test the code on.
I assume you have read all the help on the wiki...
SerialPort @ https://gambaswiki.org/wiki/comp/gb.net/serialport
Stream @ https://gambaswiki.org/wiki/comp/gb/stream
to write to a stream it is done something like this..
(I think the stream MUST be Opened before writing but i could be wrong.
Dim sMyText As String = "This is some text"
SerialPort1.Open ' open the port for communication
Write #SerialPort1, sMyText ' write the text to the stream
Print #SerialPort1, "Using Print will add linefeed to end of string"
SerialPort1.Close ' close the port after use.
But like i say i only assume this is how serialport works as i do not have anything to test the code on.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Serial Comm Port
It seems that the problem is not in the syntax, but in the system) try this simple example for yourself)
- Attachments
-
- Screenshot_20231208_102224.png (47.13 KiB) Viewed 11047 times