Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            RFID rfid = new RFID();

            rfid.Portcom  = comboBox1.Text;
            rfid.Buadrate = int.Parse(comboBox2.Text);
            System.IO.Ports.SerialPort serial = new System.IO.Ports.SerialPort(rfid.Portcom,
                                                                               rfid.Buadrate,
                                                                               System.IO.Ports.Parity.None,
                                                                               8,
                                                                               System.IO.Ports.StopBits.One);
            if (rfid.Buadrate == 14400)
            {
                serial.Open();
                MessageBox.Show("Connection Port: " + rfid.Portcom + " Success");
                button1.Visible = false;
            }
            else
            {
                MessageBox.Show("Connection Failed");
            }
            //MessageBox.Show("Success Connect Port : "+rfid.Portcom +" Buadrate : "+rfid.Buadrate);
            //Connect Button
        }