Ejemplo n.º 1
0
 private void buttonReceive_Click(object sender, EventArgs e)
 {
     if (radioButtonConnect.Checked)
     {
         textBoxRececive.Text = Serialport.ReadExisting();
     }
 }
Ejemplo n.º 2
0
 private void buttonSend_Click(object sender, EventArgs e)
 {
     if (textBoxRececive.Text.Length > 0)
     {
         Serialport.WriteLine(textBoxRececive.Text);
     }
 }
Ejemplo n.º 3
0
 private void buttonConnect_Click_1(object sender, EventArgs e)
 {
     if (comboBoxIport.SelectedIndex > -1)
     {
         Serialport.PortName = comboBoxIport.Items[comboBoxIport.SelectedIndex].ToString();
         if (comboBoxbaud.SelectedIndex > -1)
         {
             Serialport.BaudRate = Convert.ToInt32(comboBoxbaud.Items[comboBoxbaud.SelectedIndex]);
             try
             {
                 Serialport.Open();
                 radioButtonConnect.Checked = true;
             }
             catch (Exception)
             {
                 MessageBox.Show("Unable to conncet");
                 radioButtonConnect.Checked = false;
             }
         }
     }
 }
Ejemplo n.º 4
0
 private void buttonDisconnect_Click(object sender, EventArgs e)
 {
     Serialport.Close();
     radioButtonConnect.Checked  = false;
     timerSerialReceicve.Enabled = false;
 }