I am trying to build an Arduino project to measure CPU and GPU temps through Open Hardware Monitor and now I have problem in C# application.
It gives this error on line 45:
A local variable named 'port' cannot be declared in this scope because it would give a different meaning to 'port', which is already used in a 'parent or current' scope to denote something else
Can I get some help? Thank you very much!
private void Init()
{
try
{
notifyIcon1.Visible = false;
port.Parity = Parity.None;
port.StopBits = StopBits.One;
port.DataBits = 8;
port.Handshake = Handshake.None;
port.RtsEnable = true;
string[] ports = SerialPort.GetPortNames();
45 foreach (string port in ports)
{
comboBox1.Items.Add(port);
}
port.BaudRate = 9600;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}