c# - Why GetPortNames method returns nothing? -


i trying send sms computer cell phone. first step: com ports use it. used code, no benefit:

private void form1_load(object sender, eventargs e) {     string[] ports = serialport.getportnames();     foreach (string prt in ports)     {         combobox1.items.add(prt);     } } 

it returns nothing. can do?

i ran following code on pc , returns "com1":

        string[] ports = serialport.getportnames();          console.writeline("the following serial ports found:");         foreach(string port in ports)         {             console.writeline(port);         }          console.readline(); 

so, it's either permissions or don't have serial ports. or perhaps registry corrupt?

note:

the port names obtained system registry (for example, hkey_local_machine\hardware\devicemap\serialcomm). if registry contains stale or otherwise incorrect data getportnames method return incorrect data.

ref: serialport.getportnames


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -