Hi,...
I have a MDI application.
I am using SerialPort class of C# in it...
How i can use same instance of that SerialPort class in my application for all child forms of MDI...
Regards,
VInay
Hi,...
I have a MDI application.
I am using SerialPort class of C# in it...
How i can use same instance of that SerialPort class in my application for all child forms of MDI...
Regards,
VInay
MDI + Serial Port
Rattlerr
You can put the control in a form that is hidden from user. Other forms just referencing to the class in that hidden form.
luai7
You can use a class with a static propertie that will hold the serial port:
public class MySerialPortHolder
{
private static SerialPort _serialPort;
public static SerialPort Value
{
get
{
if (_serialPort == null)
{
_serialPort = new SerialPort("...");
// TODO: Initialize serial port.
}
return _serialPort;
}
}
}
In all your forms you can so:
SerialPort seriaPort = MySerialPortHolder.Value;