private void homeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            welcomeForm obj = new welcomeForm();

            obj.Show();
            Visible = false;
        }
        private void SubmitButton_Click_1(object sender, EventArgs e)
        {
            SqlConnection cnn;

            cnn = new SqlConnection("Server=.\\SQLEXPRESS;Database=DTMS; Integrated Security=true");
            String Query = "insert into user_table (username,password) values ('" + this.UserNameTextBox.Text + "','" + this.PassWordTextBox.Text + "');";

            cnn.Open();
            string username = UserNameTextBox.Text;

            String password = PassWordTextBox.Text;


            String     query = "select username,userpass from user_table;";
            SqlCommand com   = new SqlCommand(query, cnn);

            SqlDataReader reader = com.ExecuteReader();
            int           flag   = 0;

            while (reader.Read())
            {
                string name = reader[0].ToString();
                string pass = reader[1].ToString();
                if (name == username && pass == password)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)                           //if user credential is matched then Usercount value is 1 otherwise it is 0
            {
                this.Hide();                         //hiding form 1
                welcomeForm obj = new welcomeForm(); //Main M1 = new Main(username);//ing user Name to Second form so we can user Logged user Name
                obj.Show();
                Visible = false;
                //MessageBox.Show("welcome");
            }
            else
            {
                loginmsg.ForeColor = Color.Red;     //if user Name is not available in database
            }
        }