public partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
SerialPort MySerialPort = new SerialPort();
txt_1.Text = MySerialPort.BaudRate.ToString();
txt_2.Text = MySerialPort.DataBits.ToString();
txt_3.Text = MySerialPort.Parity.ToString().ToUpper();
txt_4.Text = MySerialPort.StopBits.ToString().ToUpper();
txt_5.Text = MySerialPort.Handshake.ToString();
}
}
It’s Output will be like this.

Then i just modify the textbox values such as 7200,7,Odd,2 & Hardware.if click Update button, those values should change in my system(Below below figure).

Finally i want to change my port settings by textbox values after i clicked the update button. What should i do for that.
Those settings are stored in the registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PortsThe values are stored in a single key as a comma-separated string.
You could use something like this then:
To read
To write
But instead of writing the hard-coded
"9600,n,8,1"value, you would construct a value from the user-supplied values in your text boxes.