mardi 13 juin 2017

How to change an event depending on which radio button is selected C#

Using a C# program to send data to an Arduino microcontroller for a CNC machine.

String is sent on the click of a button to the Arduino.

Want the code to be different depending on which radio button has been selected.

Current format is:

if (radio1.Checked)
{
serialPort1.Write("string1");
}
else if (radio2.Checked)
{
serialPort1.Write("string2");
}

Having the string sent on CheckedChanged event is not possible.

Aucun commentaire:

Enregistrer un commentaire