954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error in port listing

Hello,

I have used the following code to list my serial ports on my computer, but i am receiving the abnormal portnames as my attachment. The portnames should be as following text:

Com3
52
8
11
38
6
13
53
4

My code:

Dim ports As String() = IO.Ports.SerialPort.GetPortNames()

For Each port In ports
            portlar.Items.Add(port)
        Next port
Attachments image000.png 1.83KB
wakeup12
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
 
For Each port As String In My.Computer.Ports.SerialPortNames
     cboPort.Items.Add(port)
Next


That's what I use to add my ports into a combo box and it works.

Dukane
Posting Whiz in Training
295 posts since Oct 2006
Reputation Points: 45
Solved Threads: 29
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: