private void BillPage_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F2)
     {
         Print_Bill_Btn_Click(null, null);
         Product_Search_Textbox.Focus();
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (!Product_Search_ListBox.Visible && !isBillPrinted)
         {
             Add_button_Click(null, null);
         }
         else if (isBillPrinted)
         {
             BillDetailsUpdation();
         }
         else if (Product_Search_ListBox.Visible && Product_Search_ListBox.Items.Count == 1)
         {
             ProductIdEntered();
         }
         else if (Product_Search_ListBox.Visible && Product_Search_ListBox.SelectedIndex != -1)
         {
             Product_Search_ListBox_MouseClick(null, null);
         }
     }
     else if (e.KeyCode == Keys.Up)
     {
         if (Product_Search_ListBox.Visible && Product_Search_ListBox.Items.Count > 0 &&
             Product_Search_ListBox.SelectedIndex != 0)
         {
             Product_Search_ListBox.Focus();
             Product_Search_ListBox.Select();
         }
         if (Product_Search_ListBox.Visible && Product_Search_ListBox.Items.Count > 0 &&
             Product_Search_ListBox.SelectedIndex == 0)
         {
             Product_Search_Textbox.Focus();
         }
     }
     else if (e.KeyCode == Keys.Down && Product_Search_ListBox.Items.Count > 0)
     {
         if (Product_Search_ListBox.Visible)
         {
             Product_Search_ListBox.Focus();
             Product_Search_ListBox.Select();
         }
     }
     else if (e.KeyCode == Keys.F3)
     {
         Cancel_Button_Click(null, null);
     }
     else if (e.KeyCode == Keys.Tab)
     {
         if (Product_Search_ListBox.Visible && Product_Search_ListBox.Items.Count == 1)
         {
             ProductIdEntered();
         }
     }
 }
示例#2
0
 private void BillPage_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         Print_Bill_Btn_Click(null, null);
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (!Product_Search_ListBox.Visible)
         {
             Add_button_Click(null, null);
         }
         else
         {
             Product_Search_ListBox_MouseClick(null, null);
         }
     }
     else if (e.KeyCode == Keys.Up)
     {
         if (Product_Search_ListBox.Visible)
         {
             Product_Search_ListBox.Focus();
         }
     }
     else if (e.KeyCode == Keys.Down)
     {
         if (Product_Search_ListBox.Visible)
         {
             Product_Search_ListBox.Focus();
         }
     }
 }