Could someone give me the correct syntax for assigning a port to the serial connection?
Var i As Integer
Var PortName as string
For i = 0 To System.SerialPortCount-1
if System.SerialPort(i).Name = “usbserial-A50285BI” then
CurrentPort = i 'Global Property
PortName = System.SerialPort(i).Name
end
Next
'Messagebox Str(currentport)
MainWindow.MainWindowSerial.device = SerialDevice.???
Thanks, Derk, I think I had it working but didn’t realize it was talking. I find some of these commands a lot more confusing to follow then the RB4.5 days. If they are trying to make XOJO easy for the average person they are going the wrong direction. Just my opinion.
No thanks, if it helps you it could help others too.
you’ll have to get used to this… trust me.
Try following the release notes it brings alot of usefull knowledge with you to be prepared.
Help me with that thought. I’m open to understanding but need to follow where your coming from. Remember I’m the person walking off the street wanting to learn how to program with XOJO.
Nope sorry. this just shows you how it could be made hard to find the right thing but enums enforce values (compile time) so you can’t assign the wrong value.
Say it used to be an integer:
Timer.Mode = 1
You could do
Timer.Mode = 999
And it would compile but give you an exception at runtime. With enums you won’t have that, you’ll get a compile time error and fix it before it’s shipped with the wrong value.
The length of this line is long, i know but it’s readable and causes less (runtime) errors.
That’s about all i can say for this line.
A list of names corresponding to valid values. And it’s all very well saying how wonderful ‘single’ used to be, but what do you do if ‘single’ were needed in another context. It’s already a data type, although that might be resolvable by context.