private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")//Nothing selected
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                textBox1.Focus();

                return;
            }



            string        StringReturn = "";
            SqlConnection con          = new SqlConnection(conStr);
            SqlCommand    cmd          = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.CommandText = "TRAN_RejectMaterialRequest";
            cmd.Parameters.Add("@MRMID", SqlDbType.Int).Value           = Convert.ToInt32(txtMRMID.Text);
            cmd.Parameters.Add("@UserID", SqlDbType.Int).Value          = Convert.ToInt32(TxtUserID.Text);
            cmd.Parameters.Add("@Remarks", SqlDbType.VarChar, 50).Value = textBox1.Text;

            cmd.Connection = con;
            try
            {
                con.Open();
                StringReturn = cmd.ExecuteScalar().ToString();
                if (StringReturn == "Approved")
                {
                    MessageBox.Show("This Request is already Approved!.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                }
                else
                {
                    MessageBox.Show("Request has been Rejected", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    MaterialRequestForApproval formTask = new MaterialRequestForApproval();
                    formTask.GetUserID(TxtUserID.Text);
                    this.Dispose();
                    formTask.Show();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
 private void MaterialRequestMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (txtForApproval.Text == "")
     {
         MaterialRequestIquiry formTask = new MaterialRequestIquiry();
         formTask.GetUserID(TxtUserID.Text);
         this.Dispose();
         formTask.Show();
     }
     if (txtForApproval.Text == "true")
     {
         MaterialRequestForApproval formTask = new MaterialRequestForApproval();
         formTask.GetUserID(TxtUserID.Text);
         this.Dispose();
         formTask.Show();
     }
     if (txtForApproval.Text == "MRI")
     {
         Material_Releasing_Inquiry formTask = new Material_Releasing_Inquiry();
         formTask.GetUserID(TxtUserID.Text);
         this.Dispose();
         formTask.Show();
     }
 }