Exemplo n.º 1
0
        private void CustomerNameDataGridView_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    //if (Convert.ToInt32(CustomerNameDataGridView.Rows[SelectedRowIndex].Cells["Quantity"].Value.ToString()) > 0)
                    {
                        CustomerNameDataGridView.Visible = false;
                        CustomerName_txt.Text            = CustomerNameDataGridView.Rows[SelectedRowIndex].Cells["Name"].Value.ToString().Trim();
                        CustomerID_txt.Text      = CustomerNameDataGridView.Rows[SelectedRowIndex].Cells["ID"].Value.ToString().Trim();
                        CustomerBalance_txt.Text = CustomerNameDataGridView.Rows[SelectedRowIndex].Cells["AMOUNT"].Value.ToString().Trim();


                        Voucher_DTPicker.Focus();
                    }
                }
                else if (e.KeyCode == Keys.Escape)
                {
                    CustomerName_txt.Focus();
                }
            }
            catch (Exception ex)
            {
                Variables.NotificationStatus       = true;
                Variables.NotificationMessageTitle = this.Name;
                Variables.NotificationMessageText  = ex.Message;
            }
        }
Exemplo n.º 2
0
 private void CustomerName_txt_KeyDown_1(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             CustomerNameDataGridView.Visible = !CustomerNameDataGridView.Visible;
         }
         if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
         {
             CustomerNameDataGridView.Focus();
         }
         else if (e.KeyCode == Keys.Enter)
         {
             if (CustomerName_txt.Text == "")
             {
                 //CustomerID_txt.Focus();
                 return;
             }
             if (CustomerNameDataGridView.SelectedRows.Count <= 0)
             {
                 for (int loop = 0; loop < CustomerNameDataGridView.Rows.Count; loop++)
                 {
                     if (CustomerNameDataGridView.Rows[loop].Visible == true)// && ItemsDataGridView.Rows[loop].Cells["CODE"].Value.ToString() == ItemCode_txt.Text)
                     {
                         CustomerName_txt.Text    = CustomerNameDataGridView.Rows[loop].Cells["Name"].Value.ToString().Trim();
                         CustomerID_txt.Text      = CustomerNameDataGridView.Rows[loop].Cells["ID"].Value.ToString().Trim();
                         CustomerBalance_txt.Text = CustomerNameDataGridView.Rows[loop].Cells["AMOUNT"].Value.ToString().Trim();
                         Voucher_DTPicker.Focus();
                         break;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Variables.NotificationStatus       = true;
         Variables.NotificationMessageTitle = this.Name;
         Variables.NotificationMessageText  = ex.Message;
     }
 }