Skip to main content

Posts

Showing posts from January, 2015

Get All COM Ports in VB.Net

Enumerate COM Ports using VB.net Public Function foo () As Integer Try Dim searcher As New ManagementObjectSearcher ( _ "root\CIMV2" , _ "SELECT * FROM Win32_SerialPort" ) For Each queryObj As ManagementObject In searcher . Get () Debug . WriteLine ( queryObj ( "Caption" )) Debug . WriteLine ( queryObj ( "Description" )) Debug . WriteLine ( queryObj ( "DeviceID" )) Debug . WriteLine ( queryObj ( "Name" )) Debug . WriteLine ( queryObj ( "PNPDeviceID" )) Next Catch err As ManagementException Stop End Try End Function Public Function bar () As Integer Try Dim searcher As New ManagementObjectSearcher ( _ "root\CIMV2" , _ "SELECT * FROM Win32_PnPEntity WHERE ConfigManagerErrorCode = 0" ) ...

Sa Baybayon

Baybay, Brgy. 9, Buenavista Agusan del Norte Near Jurassic Park