Ejemplo n.º 1
0
        private void tbxGroupName_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (tbxGroupName.Text.Trim() == "")
                {
                    MessageBox.Show("Account Group Name Can Not Be Blank!");
                    tbxGroupName.Focus();
                    return;
                }
                if (objaccbl.IsGroupExists(tbxGroupName.Text.Trim()))
                {
                    MessageBox.Show("Account Group Name already Exists!");
                    tbxGroupName.Focus();
                    return;
                }

                if (this.ActiveControl != null)
                {
                    this.SelectNextControl(this.ActiveControl, true, true, true, true);
                }
                e.Handled = true; // Mark the event as handled
            }
        }