I have a communication tool I've written to send data over a COM port on a computer, currently you have to Search for COM ports and then select the correct COM port, the UI looks like this:
However, I would like to be able to display the full COM port identifier in the list. I'm talking the full names here:
Is there a way to do this in C#? I've done a bit of digging and can't find it. Here is how I'm currently searching for available COM ports:
private void find_open_ports_Click(object sender, EventArgs e)
{
string[] open_com_array = null;
int index = -1;
string com_port_name = null;
open_com_array = SerialPort.GetPortNames();
do
{
index += 1; // search next com port to see if it's open
open_ports.Items.Add(open_com_array[index]); // adds open com port to dropdown box
}
while (!((open_com_array[index] == com_port_name) || (index == open_com_array.GetUpperBound(0))));
Array.Sort(open_com_array);
if (index == open_com_array.GetUpperBound(0));
{
com_port_name = open_com_array[0];
}
open_ports.Text = open_com_array[0];
com_status.Text = "Open Selected COM Port";
}
Thanks for the help in advance!