Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. How can I Get my Port ID

How can I Get my Port ID

Scheduled Pinned Locked Moved Hardware & Devices
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Omotayo
    wrote on last edited by
    #1

    Hi, Pls can someone help on how i can get my Serial Port ID? thanks bablo

    bablo

    J 1 Reply Last reply
    0
    • O Omotayo

      Hi, Pls can someone help on how i can get my Serial Port ID? thanks bablo

      bablo

      J Offline
      J Offline
      joon vh
      wrote on last edited by
      #2
                  ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from WIN32_SerialPort");
                  foreach(ManagementObject Port in searcher.Get()) 
                  {
                      // use the Port object to get the values you need...
                      Console.Write(Port.GetPropertyValue("Name"));
                  }
      

      you need a using and a reference to System.Management. -- modified at 10:40 Wednesday 4th April, 2007 I'm sorry, this of course, is only C# code, if this isn't what you were looking for,.. well then specify :p


      Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups