private void FLGNBTN_Click(object sender, EventArgs e) { try { SqlConnection tcon = new SqlConnection(@"Data Source =AD-PC\SQLEXPRESS10;Initial Catalog = tlogin; Integrated Security = True; Connect Timeout = 30; Encrypt = False; TrustServerCertificate = False; ApplicationIntent = ReadWrite; MultiSubnetFailover = False"); SqlDataAdapter sda = new SqlDataAdapter("select Count(*) from flogin where FacultyId = '" + FTXTBOXID.Text + "' and Pass='******'", tcon); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { Global.FacultyId = Int32.Parse(FTXTBOXID.Text); MessageBox.Show(" ID No:'" + Global.FacultyId + "' Successfully Logged in"); this.Hide(); FMenu menu = new FMenu(); counter = 3; if (menu.Enabled || counter == 3) { SMS.Text = "Faculty ID : " + Global.FacultyId; SMS.Visible = true; SMS.Icon = new System.Drawing.Icon(Path.GetFullPath(@"C: \Users\AD\source\repos\Student Management System\WindowsFormsApp1\Resources\Black.ico")); SMS.BalloonTipText = "Faculty ID : '" + Global.FacultyId + "' You're Successfully Logged in "; SMS.BalloonTipTitle = "Have a Great Day Ahead :) :)"; SMS.ShowBalloonTip(100); SMS.ContextMenuStrip.AllowTransparency = true; } menu.Show(); } else { MessageBox.Show("Check your Id or Password"); } } catch (System.Exception) { MessageBox.Show("Please Enter Integer Value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }