Click here to Skip to main content
15,886,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I do also want to know how can I Display Text on 8 digit Pole Display.

I write the code with VB.net 2008.
it does not work

What I have tried:

private void button1_Click(object sender, EventArgs e)
{

SerialPort sp = new SerialPort();

sp.PortName = "COM1";
sp.BaudRate = 9600;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.Open();
sp.WriteLine (" ");
sp.WriteLine("Hi welocme here");

sp.Close();
sp.Dispose();
sp = null;
Posted
Updated 22-Nov-20 21:07pm
Comments
Henry Z. 23-Nov-20 1:55am    
It's hard to help out when you don't provide the Make and Model of the device you are trying to connect to...

1 solution

It doesn't work because that is not VB - it's C#.
Try using a online translator such as Code Converter C# to VB and VB to C# – Telerik[^]
VB
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim sp As SerialPort = New SerialPort()
    sp.PortName = "COM1"
    sp.BaudRate = 9600
    sp.Parity = Parity.None
    sp.DataBits = 8
    sp.StopBits = StopBits.One
    sp.Open()
    sp.WriteLine(" ")
    sp.WriteLine("Hi welocme here")
    sp.Close()
    sp.Dispose()
    sp = Nothing
End Sub
It you are going to blindly copy and paste code, you need to check what language it is in before trying to use it ...
 
Share this answer
 
Comments
Maciej Los 23-Nov-20 4:46am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900