Exemple #1
0
        }//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()
Exemple #2
0
        }//End Btn_Exit_Click()

        /// <summary>
        /// Purpose: to advance the cursor to the next textbox on the enter key stroke.
        /// </summary>
        /// <param name="sender">TxtBx_ItemDescription_KeyPress</param>
        /// <param name="e">Not Used</param>
        private void TxtBx_ItemDescription_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                TxtBx_Quantity.Focus();
                TxtBx_Quantity.SelectAll();
            }
        }//End TxtBx_ItemDescription_KeyPress()