-
April 17th, 2023, 01:14 PM
#1
Help with finding com ports
Greetings from Pennsylvania.
I have a VB6 program that can send and receive serial data with an Arduino board.
It would be helpful if I could acquire the com port the Arduino is using on start up
of the VB program.
My attempts to use the Microsoft example results in a syntax error. I do not understand
the example requirements enough to continue. Could one of you folks explain to me what I need
to do to make the compiler happy?
'have set: Project->References->System_Windows_Forms
Private Sub Command1_Click()
' Show all available COM ports.
For Each sp As String In My.Computer.Ports.SerialPortNames
ListBox1.Items.Add (sp)
Next
End Sub
This example requires:
A project reference to System.Windows.Forms.dll.
Access to the members of the System.Windows.Forms namespace.
Add an Imports statement if you are not fully qualifying member names in
your code. For more information, see Imports Statement
ref:
-
April 18th, 2023, 03:11 AM
#2
Re: Help with finding com ports
I suggest you re-post this on this site's sister-site at:
https://www.vbforums.com/forumdispla...-6-and-Earlier
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|