void add_list_Control_KeyPress(object sender, KeyPressEventArgs e) { if (add_rem_name_col.Index == add_remainders_list.CurrentCell.ColumnIndex) { Control ctl = (Control)sender; //e.SuppressKeyPress = false; //e.Handled = true; //string pressedKey = ((char)e.KeyCode).ToString(); string pressedKey = e.KeyChar.ToString(); //if (!e.Shift) //{ // pressedKey = pressedKey.ToLower(); //} //if (e.KeyData != Keys.Shift) //{ if (pressed_name_keystrokes != ProductInfo_Main_Form.UTF8String(pressedKey)) { pressed_name_keystrokes += ProductInfo_Main_Form.UTF8String(pressedKey); } //} status_bar_lbl.Text = pressed_name_keystrokes; if ("" != pressed_name_keystrokes) { try { Product[] prod_suggestions = ProductInfo_Main_Form.conn.GetProductSuggestions(pressed_name_keystrokes); if (prod_suggestions.Length > 0) { add_remainders_list.CurrentRow.Cells[add_rem_barcode_col.Index].Value = prod_suggestions[0].barcode; foreach (object nextItem in add_rem_name_col.Items) { if (nextItem.ToString() == prod_suggestions[0].name) { add_remainders_list.CurrentRow.Cells[add_rem_name_col.Index].Value = nextItem.ToString();//prod_suggestions[0].name; break; } } /* * add_rem_name_col.Items.Clear(); * foreach (Product nprod in prod_suggestions) * { * add_rem_name_col.Items.Add(nprod.name); * } * that's if product name is a combobox * */ } } catch (NullReferenceException) { MessageBox.Show("null ref"); } } }//AutoComplete Product Name }
private void buyer_chooser_KeyPress(object sender, KeyPressEventArgs e) { Control ctl = (Control)sender; //e.SuppressKeyPress = false; e.Handled = true; //string pressedKey = ((char)e.KeyValue).ToString(); /* * if (!e.Shift) * { * pressedKey = pressedKey.ToLower(); * } * else * { * return;//shift was pressed * pressed_buyer_name_keystrokes += ProductInfo_Main_Form.UTF8String(ProductInfo_Main_Form.EngFromUTF8String(pressedKey).ToUpper()); * }*/ string pressedKey = e.KeyChar.ToString(); pressed_buyer_name_keystrokes += ProductInfo_Main_Form.UTF8String(pressedKey); status_bar_lbl.Text = pressed_buyer_name_keystrokes; if ("" != pressed_buyer_name_keystrokes) { try { Buyer[] matched_buyers = (from Buyer b in all_buyers where b.saxeli.Contains(pressed_buyer_name_keystrokes) select b).ToArray(); if (matched_buyers.Length > 0) { buyer_chooser.SelectedItem = matched_buyers[0].saxeli; buyer_chooser.Text = matched_buyers[0].saxeli; } else { status_bar.Text = "მსგავსი მყიდველი არ მოიძებნა!"; } } catch (NullReferenceException) { MessageBox.Show("null ref"); } } }
private void supplier_chooser_KeyPress(object sender, KeyPressEventArgs e) { Control ctl = (Control)sender; //e.SuppressKeyPress = false; e.Handled = true; //string pressedKey = ((char)e.KeyValue).ToString(); /*if (!e.Shift) * { * pressedKey = pressedKey.ToLower(); * } * if (e.KeyData != Keys.Shift) * { * pressed_supp_name_keystrokes += ProductInfo_Main_Form.UTF8String(pressedKey); * }*/ string pressedKey = e.KeyChar.ToString(); pressed_supp_name_keystrokes += ProductInfo_Main_Form.UTF8String(pressedKey); status_bar_lbl.Text = pressed_supp_name_keystrokes; if ("" != pressed_supp_name_keystrokes) { try { Supplier[] matched_supps = (from Supplier s in all_suppliers where s.saxeli.Contains(pressed_supp_name_keystrokes) select s).ToArray(); if (matched_supps.Length > 0) { supplier_chooser.SelectedItem = matched_supps[0].saxeli; supplier_chooser.Text = matched_supps[0].saxeli; } else { status_bar.Text = "მსგავსი მომწოდებელი არ მოიძებნა!"; } } catch (NullReferenceException) { MessageBox.Show("null ref"); } } }