private void metroTile1_Click(object sender, EventArgs e)
 {
     if (txtstatus.Text.Length == 0 || txtdate.Text.Length == 0 || cmbsalesorder.Text == "")
     {
         MessageBox.Show("Please check if your entered data to all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         String     status = txtstatus.Text;
         DBDelivery de     = new DBDelivery();
         int        line   = de.update(status, no);
         if (line == 1)
         {
             MessageBox.Show("Data entered successfully", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
        private void mtadd_Click(object sender, EventArgs e)
        {
            if (txtstatus.Text.Length != 0 && txtdate.Text.Length != 0 && cmbsalesorder.SelectedIndex != 0)
            {
                String date   = txtdate.Text;
                String status = "Active";
                int    so_no  = Convert.ToInt32(cmbsalesorder.Text);

                DBDelivery d    = new DBDelivery();
                int        line = d.setDelivery(date, status, u_id, so_no);
                if (line == 1)
                {
                    MessageBox.Show("Data entered successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Check if all the fields are filled", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void Delivery_Load(object sender, EventArgs e)
        {
            txtdate.Text = System.DateTime.Now.ToString("MM/dd/yyyy");
            DBSales       s = new DBSales();
            SqlDataReader DR;

            DR = s.getSalesOrderID();
            while (DR.Read())
            {
                cmbsalesorder.Items.Add(DR[0]);
            }
            SqlDataAdapter da;
            DBDelivery     i = new DBDelivery();

            da = i.getDelivery();
            DataTable dt = new DataTable();

            da.Fill(dt);
            dataGridView1.DataSource = dt;
        }