Quote:
i will open the interface to connect direct to the serial without pressing any button.
This implies that you first need to load your saved settings from someplace. That's up to you: Config file, registry, whatever.
Create a method for loading your settings. LoadSettings(); for example.
Create a method for opening your serial port. StartSerial(); for example
From the .Load event of the custom control you are making call the LoadSettings() method followed by the StartSerial() method.
- private void TempSensor_Load(object sender, EventArgs e)
-
{
-
LoadSettings();
-
StartSerial();
-
}
-
For testing I suggest you also add a Start button that calls the same methods. This way you can start/stop it at will and not just when the control is loaded.
Quote:
some examples for how to send and read data.
Before we just give you all the code... do some reading and some experimenting. If you read up on the SerialPort component (
MSDN Library for example) you will see there are methods for .Read() .ReadLine() .Write() and .WriteLine()