}//End ButItNow() /// <summary> /// Purpose: have the textboxes intereact with the Class. /// </summary> private bool UpdateObject() { ///<summary> /// A region for local variables /// </summary> #region Local Var int _intTestValue = 0; double _doubleTestValue = 0.0; #endregion Local Var ErrProvider.Clear(); si.Description = TxtBx_ItemDescription.Text; si.SQuantity = TxtBx_Quantity.Text; //Condition will test bool if it can prase or not, as well as, if the value is too low if (!(int.TryParse(si.SQuantity, out _intTestValue)) || _intTestValue <= 0) { ErrProvider.SetError(TxtBx_Quantity, INV_QNTY); TxtBx_Quantity.Focus(); TxtBx_Quantity.SelectAll(); return(false); } //Condition will test bool if it can prase or not, as well as, if the value is too low si.SPrice = TxtBx_UnitPrice.Text; if (!(double.TryParse(si.SPrice, out _doubleTestValue)) || _doubleTestValue <= 0) { ErrProvider.SetError(TxtBx_UnitPrice, INV_PRC); TxtBx_UnitPrice.Focus(); TxtBx_UnitPrice.SelectAll(); return(false); } //If everything checks out, it will return true and allow the code to show the message box salesInvoice else { return(true); } }//End UpdateObject()
}//End TxtBx_ItemDescription_KeyPress() /// <summary> /// Purpose: to advance the cursor to the next textbox on the enter key stroke. /// </summary> /// <param name="sender">TxtBx_Quantity_KeyPress</param> /// <param name="e">Not Used</param> private void TxtBx_Quantity_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { TxtBx_UnitPrice.Focus(); TxtBx_UnitPrice.SelectAll(); } }//End TxtBx_Quantity_KeyPress()