not post your whole app, coz no one is going to read it all. and don't need to.
post just that part with your problem.
witch is as OriginalGriff already mentioned that you give a String to a Property witch awaits an Integer.
you better put your Project to
Option Strict ON
so Visual Studio shows you that error already while writing that piece of code.
as simple Solution for this, you just need to tell the
Integer.Parse
function that the String represents a Hex value
SerialPort1.BaudRate = Integer.Parse(cmbBaud.Text,System.Globalization.NumberStyles.HexNumber)
//Edit: This is wrong for your code!!
Update:
Error 1
if I change it to
Dim myPort As String() = IO.Ports.SerialPort.GetPortNames()
it works for me.
just have seen you defined it
as Array
better don't do that. define it
as String()
and define it local as it's not going to be used elsewhere
instead of the
For
loop you can use just
cmbPort.Items.AddRange(myPort)
cmbPort.SelectedIndex = 0
cmbBaud.SelectedIndex = 0
Error 2
Well its simple, the signatures are not matching
text as Byte VS text as String
you need to change one, the Method or the Delegate
also
IMPORTANT .. there is another problem
have a look at
Serial port - Wikipedia, the free encyclopedia[
^]
9600, 19200, 38400 and so on.. are allready Integers.. thats no HEX if I read your program right.
It will only work if you select 9600 (Hex) as this is 38400 (dec) whitch is an valid Port speed. No need to parse that with base 16 ..
just an
SerialPort1.BaudRate = Integer.Parse(cmbBaud.Text)
like OriginalGriff sayd is the right answer
There is no HEX in that code you posted! I think you got that wrong!