System.IO.Ports.SerialPort.GetPortNames return wrog names above CO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SamB

    System.IO.Ports.SerialPort.GetPortNames return wrog names above CO

    Hello all!

    MY CASE:

    I'm using VB.net 2005 express on a Dell Laptop with an USB Bluetooth key.
    I'm trying to send data to a pocketPC.
    COM numbers changes each time i've got a new bluetooh "connection " with my
    PDA.
    I need 2 ports, one for ingoing data, one for outgoing data (that's how
    serial port profile in bluetooth is made)
    Sometime it's COM 5 and 6, some time 11 and 12.

    I'm using this code to get the port names, display them in a combobox to let
    the user choosing the right one:
    in the Form load event:
    Dim ports As String() = System.IO.Ports .SerialPort.Get PortNames
    Dim port As String
    For Each port In ports
    PortIn_List.Add (port)
    PortOut_List.Ad d(port)
    Next port
    'CMB_xxxx are combobox
    CMB_PortNumIn.D ataSource = PortIn_List
    CMB_PortNumOut. DataSource = PortOut_List

    In the OK button:
    SerialPortIn.Po rtName = CMB_PortNumIn.T ext
    SerialPortOut.P ortName = CMB_PortNumOut. Text

    MY PROBLEM:

    with all COM numbers under 10, no problem, but with COM number above 9 (11
    and 12 in my case), getportnames return "COM11c" and "COM12c"!
    Is anybody can "duplicate" this error? Is it a bug?
  • Dick Grier

    #2
    Re: System.IO.Ports .SerialPort.Get PortNames return wrog names above CO

    Hi Sam,
    [color=blue][color=green]
    >>[/color][/color]
    "COM11c" and "COM12c"!
    <<

    When you use these values to set the port, do they work, or is there an
    error? I don't have any BT hardware to test right now, but I don't see this
    with some other virtual serial port drivers for hardware that I do have
    installed.

    Dick

    --
    Richard Grier, MVP
    Hard & Software
    Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
    Edition,
    ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004.
    See www.hardandsoftware.net for details and contact information.


    Comment

    • SamB

      #3
      Re: System.IO.Ports .SerialPort.Get PortNames return wrog names abov

      No, it doesn't work with those names. I have to write "COM11" and "COM12" in
      the comboboxes!
      Are you able to test this function with a high numbuer next to COM?

      "Dick Grier" wrote:
      [color=blue]
      > Hi Sam,
      >[color=green][color=darkred]
      > >>[/color][/color]
      > "COM11c" and "COM12c"!
      > <<
      >
      > When you use these values to set the port, do they work, or is there an
      > error? I don't have any BT hardware to test right now, but I don't see this
      > with some other virtual serial port drivers for hardware that I do have
      > installed.
      >
      > Dick
      >
      > --
      > Richard Grier, MVP
      > Hard & Software
      > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
      > Edition,
      > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004.
      > See www.hardandsoftware.net for details and contact information.
      >
      >
      >[/color]

      Comment

      • SamB

        #4
        Re: System.IO.Ports .SerialPort.Get PortNames return wrog names abov

        Hello Dick, i have download VSterm from your pages and the problem is the same!
        I can email you a capture of my screen with "COM14c" and "COM13c" in your
        settings form of VSTerm! When I select them, no problem, but when I try to
        open it, nothing happen, and the port open item in the menu is not checked!

        It seems that when I move my usb dongle from Usb port to Usb Hub, COM number
        change, that's why today, number are 13 and 14.
        My Usb dongle is a "Top suxess" one, The chipset came from CSR, the driver
        from Microsoft, V 5.1.2600.2180

        "Dick Grier" wrote:
        [color=blue]
        > Hi Sam,
        >[color=green][color=darkred]
        > >>[/color][/color]
        > "COM11c" and "COM12c"!
        > <<
        >
        > When you use these values to set the port, do they work, or is there an
        > error? I don't have any BT hardware to test right now, but I don't see this
        > with some other virtual serial port drivers for hardware that I do have
        > installed.
        >
        > Dick
        >
        > --
        > Richard Grier, MVP
        > Hard & Software
        > Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
        > Edition,
        > ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004.
        > See www.hardandsoftware.net for details and contact information.
        >
        >
        >[/color]

        Comment

        Working...