B4J Question COM port issue

frodotorbins83

New Member
My PC does not have COM Port (But have USB). Because there is no COM port - list is empty (imange in attachment). How the sutuation with no COM port can be handled? I mean "if there is no port - how to block the "open" button or raise an exeption which blocks.

Example:
Sub AppStart (Form1 As Form, Args() As String)
serial.Initialize("")
ComboBox1.Items.AddAll(serial.ListPorts)
log(serial.ListPorts)
End Sub

In Logs window : ArrayList []

How can I block "open" button and understand the serial.listports is empty?

16317804.png
 
Last edited:

Daestrum

Expert
Licensed User
Longtime User
Possibly,
B4X:
If ComboBox1.Items.Size = 0 then YourButton.Enabled = False
 
Upvote 0
Top