E
E
Eugene2014-08-13 11:16:18
css
Eugene, 2014-08-13 11:16:18

How to find out the COM port number?

Hello.
I know how to find out the name through "SerialPort", but how to get exactly the number - no.
Please help me in this matter.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Laid, 2016-06-08
@IvanRobot

Raise the selector hierarchy further.
That is, before .b-main-menu__item add the name of the tag. Those. if it's a div, then:
div.b-main-menu__item Better
yet, add a top-level block
i.e. .b-main-menu__item is in a .block block, then:
.block div.b-main-menu__item

N
Nikolai Shabalin, 2016-06-08
@nikolayshabalin

max-device-width
Screen size, not "screen resolution".
Try max-width.

S
Sergey Zelensky, 2016-06-08
@SergeyZelensky-Rostov

Actually, this is how it's done

@media screen and (max-width: 720px) {
    .b-main-menu__item {
      line-height: 100px;
      background: green;
    }
}

D
Denis Antonenko, 2014-09-10
@dabrahabra

The number is rigidly linked to the name: COM[NUMBER]. That is, in your case, you can simply cut the number from the port name. Something like:

SerialPort.GetPortNames().Select(port =>
{
  var portNumStr = port.Substring(3);
  int portNumber = 0;
  return new {
    PortName = port,
    PortNumber = int.TryParse(portNumStr, out portNumber)
        ? (int?)portNumber
        : null
  };
}).ToList().ForEach(pi => {
  Console.WriteLine("Name: {0} \t Number: {1}", pi.PortName, pi.PortNumber);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question