I have a serial port and button is in my main form.I want that, when I click on button then it open another form and set serial port properties.for example stopbits and baudrate and ..... How can I access to serialport properties in form2? How can I write cods?.I Write this code
//Form1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public SerialPort port = new SerialPort("COM1",
9600, Parity.None, 8, StopBits.One);
.
.
.
private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.Show();
}
}
// Form2
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.port.BaudRate=9600;
}
}
but this cod can't change BaudRate in Form1. can help me?