private void btn_login_Click(object sender, EventArgs e) { try { var data = new WebClient() { Encoding = Encoding.UTF8 }.DownloadString("http://localhost:55394/Login/Default/Login/" + tb_username.Text.ToString() + "," + tb_password.Text.ToString() + ""); if (data == "") { MessageBox.Show("Kullanıcı Adınız veya Şifreniz Hatalı! Lütfen Kontrol Edip Tekrar Deneyiniz."); } else { person.TeacherID = data; Form_Main main = new Form_Main(); main.Show(); Hide(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { try { if (serialPort1.IsOpen == true) { serialPort1.Close(); } Form_Main m = new Form_Main(); m.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }