title: GUI with Serial Communication C#
body: <p>I am new to C# and Visual Studio. I have built a GUI to choose the COM port from a  MenuStrip in Visual Studio 2013. What I want to know is how can I connect this with serial port communication.</p>
  
  <p>Should I use a another class for serial communication? Or can I do it in the same class? How can it be programmed?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.IO.Ports;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.IO;
  namespace exo_new
  {
  public partial class rehab : Form
  {
      public rehab()
      {
          InitializeComponent();
      }
  
      private void textBox1_TextChanged(object sender, EventArgs e)
      {
  
      }
  
      private void conndToolStripMenuItem_Click(object sender, EventArgs e)
      {
  
      }
  
      private void cOM1ToolStripMenuItem_Click(object sender, EventArgs e)
      {
          cOM1ToolStripMenuItem.Checked = true;
          cOM2ToolStripMenuItem.Checked = false;
          cOM3ToolStripMenuItem.Checked = false;
          cOM4ToolStripMenuItem.Checked = false;
          cOM5ToolStripMenuItem.Checked = false;
          cOM6ToolStripMenuItem.Checked = false;
          cOM7ToolStripMenuItem.Checked = false;
          cOM8ToolStripMenuItem.Checked = false;
          cOM9ToolStripMenuItem.Checked = false;
          cOM10ToolStripMenuItem.Checked = false;
      }
  
      private void cOM2ToolStripMenuItem_Click(object sender, EventArgs e)
      {
          cOM2ToolStripMenuItem.Checked = true;
          cOM1ToolStripMenuItem.Checked = false;
          cOM3ToolStripMenuItem.Checked = false;
          cOM4ToolStripMenuItem.Checked = false;
          cOM5ToolStripMenuItem.Checked = false;
          cOM6ToolStripMenuItem.Checked = false;
          cOM7ToolStripMenuItem.Checked = false;
          cOM8ToolStripMenuItem.Checked = false;
          cOM9ToolStripMenuItem.Checked = false;
          cOM10ToolStripMenuItem.Checked = false;
      }
  </code></pre>