| | |
Find Com Port
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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 |
.net .net2008 2005 2008 access account application arithmetic array basic beginner browser button buttons center check click code combo crystalreport cuesent database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel listview module monitor net networking number open output panel passingparameters picturebox picturebox1 picturebox2 port print printing problem project regex right-to-left searchvb.net select settings shutdown socket sqldatbase sqlserver survey tcp temperature text textbox timespan toolbox transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





