
Probably all wrong, but you have to get the baud rate, etc., in there somewhere.Īgain, I'm not sure of the right syntax. I added the stuff between the parenthesis by clicking on a little pulldown menu that appeared when I cross the pointer over the first part of the statement. SerialPort1.Encoding = īut the syntax seems to be wrong for VB Express as I get a bunch of errors, most telling me the statements "SerialPort1" are not declared. (No H1cr to com2) I've also tried samperiau's suggestions of adding:

It shows no errors at the bottom of the screen(and I think that means the syntax is OK), but when I run it, nothing happens. Sub SendSerialData( ByVal data As String ) I did call my subroutine snippet from the help example within the method body as you suggested, and here it is: Thanks to you both, Mick & samperiau, for trying to help me,īut I feel like I've been dumped into a foreign country, and don't speak a word of their language. Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase. Private Sub Button2_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Now that I have this figured out, I can control a myriad of features via the comports. This toggles remote control on/off on a communications receiver. One sends H1cr to com2, the other sends H0cr to com2. I now have two buttons on the screen with message boxes that show when the buttons are pressed. If I can get that to work, I can build up some code from that point. I'm trying to turn on a communications receiver. If I could just get this one little thing to work, it might start to actually be fun. It just seems very convoluted compared to the old Basic code. If someone could please send me the entire code to just send one simple "H1carriagereturn" to a comport, it might give me the incentive to learn more about coding in Visual Basic. I don't get any errors when I run it, but neither does it show anything in the list box that I drug over to my form1. I've also tried the get-serial-ports example:įor Each sp As String In My. I've tried the simple example in the help file:īut simply copying and pasting it into my form1 window doesn't make it do anything. I've tried the code snippets, (probably don't know how to use them), and looked at examples of long serial port programs, (don't understand anything about them). I've just started my 16 lessons in Visual Basic Express 2005 and I'm learning my first programming since old GFA Basic.īut my goal doesn't seem to be part of the lesson plan, and that is to simply send "H1carriagereturn" to com2 at 4800 N81.
