| | |
Find Com Port
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 14
Reputation:
Solved Threads: 0
Hi,
I am connecting a scanner to a USB port.
The scanner works as a com port connection.
Before I can talk to the scanner I need to know which com port the scanner is using.
When I know which com port it is on I can wake it up and ask it if it is ready.
What code could I use to find out what com ports are being used on the computer.
I can see this information in System-Hardware but I need to do it programmaticaly
I think VB.net has a method to do this, am I right?
Many thanks for any help here.
Best Regards,
Tony
I am connecting a scanner to a USB port.
The scanner works as a com port connection.
Before I can talk to the scanner I need to know which com port the scanner is using.
When I know which com port it is on I can wake it up and ask it if it is ready.
What code could I use to find out what com ports are being used on the computer.
I can see this information in System-Hardware but I need to do it programmaticaly
I think VB.net has a method to do this, am I right?
Many thanks for any help here.
Best Regards,
Tony
I'm not sure what you're talking about doing exactly, but when I talked to Integrated Circuits via the Serial Port I used the System.IO.Ports Namespace.
Check the "Base Class Libraries - Group 2 Samples" section on the here for hardware/port samples. That is where I started when looking for code dealing with the serial port, hopefully you can find something pertinant in there.
Good luck and let us know how it works out!
EDIT: The Using serial ports with the new Port class sample should have some code in there that enumerates the com ports.
Check the "Base Class Libraries - Group 2 Samples" section on the here for hardware/port samples. That is where I started when looking for code dealing with the serial port, hopefully you can find something pertinant in there.
Good luck and let us know how it works out!
EDIT: The Using serial ports with the new Port class sample should have some code in there that enumerates the com ports.
Last edited by cutepinkbunnies; Aug 1st, 2008 at 12:16 am.
•
•
Join Date: Aug 2007
Posts: 14
Reputation:
Solved Threads: 0
Hello all,
I have found the solution to my problem and here is the code for it.
List the com ports on the computer.
Best regards,
Tony
I have found the solution to my problem and here is the code for it.
List the com ports on the computer.
VB.NET Syntax (Toggle Plain Text)
Imports System Imports System.IO.Ports Imports System.Threading Public Class frmMain Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Get a list of serial port names. Dim ports As String() = SerialPort.GetPortNames() ' Show a label with Action information on it lblComFound.Text = "The following serial ports were found:" ' Put each port name Into a comboBox control. Dim port As String For Each port In ports cmbo1.Items.Add(port) Next port ' Select the first item in the combo control cmbo1.SelectedIndex = 0 End Sub End Class
Best regards,
Tony
![]() |
Similar Threads
- How do I communicate to a USB port through C? (for Linux and Windows) (C)
- How to check what COM port a device is connected to? (IT Professionals' Lounge)
- Port forwarding (Networking Hardware Configuration)
- Can't find the ethernet port (PCI and Add-In Cards)
- IIS port 80 ??? (Windows Servers and IIS)
- How do i change/get my port number? (Java)
- Port 80 problem (Linux Servers and Apache)
- Port number, ip address, computer name (Windows 95 / 98 / Me)
- IP Sharing....too cheap for a router! (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: how to store data into sql server using VB 6
- Next Thread: Parsing Zip Files VB.Net
| Thread Tools | Search this Thread |
"crystal .net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port position print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml year





