private void TbUID_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && !String.IsNullOrWhiteSpace(TbUID.Text)) { if (CbQuantityOff.IsChecked == true) { Bnsubmit_Click(sender, e); } else { Tbquantity.Focus(); Tbquantity.SelectAll(); } } else { TbUID.Focus(); } }
private void Tbquantity_PreviewKeyDown_1(object sender, KeyEventArgs e) { if (e.Key == Key.Space) { string q = Tbquantity.Text.ToString(); double number; //bool result = double.TryParse(q); if (!double.TryParse(q, out number)) { Lbstatus.Content = "Please enter only numbers"; Tbquantity.Focus(); Tbquantity.SelectAll(); } else { Bnsubmit.Focus(); Bnsubmit_Click(sender, e); } } }