I am working with serialport. I have two window forms and I need to use the serialPort in both forms. How can I send serialport from one form to the 2nd one as a parameter? My code looks like:
namespace SimpleSerial
{
public partial class Form1 : Form
{
Form2 pp = new Form2()
public Form1()
{
InitializeComponent();
pp.ShowDialog();
}
private void buttonStart_Click(object sender, EventArgs e)
{
serialPort1.PortName = "Com3";
serialPort1.BaudRate = 9600;
and code for 2nd Form:
namespace SimpleSerial
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
getAvailablePorts();
}