private void TxtDialog_Validating(object sender, CancelEventArgs e) { if (_labelname == "Quantity:") { decimal dialogval = 1; decimal.TryParse(TxtDialog.Text, out dialogval); if (dialogval <= 0) { MessageBox.Show("Value must be greater then Zero ...!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtDialog.Focus(); return; } } }
private void FrmDialogBox_Load(object sender, EventArgs e) { this.Text = _formname.ToString(); LblDialog.Text = _labelname.ToString(); TxtDialog.Text = _textDialog.ToString(); if (_labelname == "Note:" || _labelname == "Product:") { TxtDialog.Multiline = true; TxtDialog.Font = new Font("Microsoft Sans Serif", 8.5f); TxtDialog.Height = 50; //TxtDialog.Text = ""; } TxtDialog.Focus(); TxtDialog.SelectAll(); }