Пример #1
3
 public static void NextFocus(TextBox tb, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && !bEnter)
     {
         bEnter = true;
         tb.Focus();
         tb.SelectAll();
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private bool Check()
        {
            if ("" == txtUserName.Text.Trim())
            {
                MessageBox.Show("请填写用户名称", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserName.Focus();
                txtUserName.SelectAll();
                goto PRO_FALSE;
            }

            if (txtPwd.Text != txtPwd2.Text)
            {
                MessageBox.Show("确认密码不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPwd.Focus();
                txtPwd.SelectAll();
                goto PRO_FALSE;
            }

            if (!m_blnEdit || (m_blnEdit && txtUserName.Text.Trim().ToUpper() != m_strEditUser.Trim().ToUpper()))
            {
                if (UserNameExist(txtUserName.Text.Trim()))
                {
                    MessageBox.Show("用户名已存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtUserName.Focus();
                    txtUserName.SelectAll();
                    goto PRO_FALSE;
                }
            }
            return(true);

PRO_FALSE:
            return(false);
        }
Пример #3
0
        private void Button3_Click(System.Object sender, System.EventArgs e)
        {
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show("口味编码不能为空!");
                TextBox1.Focus();
                TextBox1.SelectAll();
                return;
            }
            if (TextBox2.Text.Trim() == "")
            {
                MessageBox.Show("口味不能为空!");
                TextBox2.Focus();
                TextBox2.SelectAll();
                return;
            }

            if (AddTaste(TextBox1.Text, TextBox2.Text))
            {
                Label5.Text = "添加成功!";
                LoadFoodTaste();
                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox1.Focus();
                TextBox1.SelectAll();
            }
        }
Пример #4
0
        private void recentFilesCountTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (recentFilesCountTextBox.Text.Length == 0)
            {
                recentFilesCountTextBox.Text = UserSettings.RecentProjects.MaxFiles.ToString();
                recentFilesCountTextBox.SelectAll();
                e.Cancel = true;
            }
            else
            {
                string errmsg = null;

                try
                {
                    int count = int.Parse(recentFilesCountTextBox.Text);

                    if (count < RecentProjectSettings.MinSize ||
                        count > RecentProjectSettings.MaxSize)
                    {
                        errmsg = string.Format("Number of files must be from {0} to {1}", RecentProjectSettings.MinSize, RecentProjectSettings.MaxSize);
                    }
                }
                catch
                {
                    errmsg = "Number of files must be numeric";
                }

                if (errmsg != null)
                {
                    recentFilesCountTextBox.SelectAll();
                    UserMessage.DisplayFailure(errmsg);
                    e.Cancel = true;
                }
            }
        }
Пример #5
0
 public void RunSearch(string search)
 {
     txtSearch.Text = search;
     txtSearch.Focus();
     txtSearch.SelectAll();
     ExecuteSearch();
 }
Пример #6
0
        private void ChangePriceWnd_Load(object sender, System.EventArgs e)
        {
            try
            { this.BackgroundImage = new Bitmap(Application.StartupPath + "/images/Background.jpg"); }
            catch {}
            try
            { this.imgIcon.Image = new Bitmap(Application.StartupPath + "/images/ChangePrice.jpg"); }
            catch {}
            try
            { this.cmdCancel.Image = new Bitmap(Application.StartupPath + "/images/blank_medium_dark_red.jpg"); }
            catch { }
            try
            { this.cmdEnter.Image = new Bitmap(Application.StartupPath + "/images/blank_medium_dark_green.jpg"); }
            catch { }

            keyboardNoControl1.Visible = TerminalDetails.WithRestaurantFeatures;

            txtPrice.Text = mDetails.Price.ToString("##0.#0");
            txtPrice.SelectAll();
            lblProductCode.Text = mDetails.ProductCode;
            lblBarCode.Text     = mDetails.BarCode;
            lblDescription.Text = mDetails.Description;
            lblUnit.Text        = mDetails.ProductUnitCode;
            lblQuantity.Text    = mDetails.Quantity.ToString("###,##0.#0");
            lblTotalAmount.Text = Convert.ToDecimal(mDetails.Quantity * mDetails.Price).ToString("###,##0.#0");
        }
Пример #7
0
        private void configFileTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string configFile = configFileTextBox.Text;

            if (configFile != String.Empty)
            {
                try
                {
                    File.Open(Path.Combine(selectedConfig.BasePath, configFile), FileMode.Open);
                }
                catch (System.Exception exception)
                {
                    configFileTextBox.SelectAll();
                    UserMessage.DisplayFailure(exception, "Invalid Entry");
                    e.Cancel = true;
                }

                if (configFile != Path.GetFileName(configFile))
                {
                    configFileTextBox.SelectAll();
                    UserMessage.DisplayFailure("Specify configuration file as filename and extension only", "Invalid Entry");
                    e.Cancel = true;
                }
            }
        }
Пример #8
0
        private void addZoneButton_Click(object sender, System.EventArgs e)
        {
            Chapter c;

            if (chapterListView.Items.Count != 0)
            {
                intIndex = chapterListView.Items.Count;
            }
            else
            {
                intIndex = 0;
            }
            TimeSpan ts = new TimeSpan(0);

            try
            {//try to get a valid time input
                ts = TimeSpan.Parse(startTime.Text);
            }
            catch (Exception parse)
            { //invalid time input
                startTime.Focus();
                startTime.SelectAll();
                MessageBox.Show("Cannot parse the timecode you have entered.\nIt must be given in the hh:mm:ss.ccc format"
                                + Environment.NewLine + parse.Message, "Incorrect timecode", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            //create a new chapter
            c = new Chapter()
            {
                Time = ts, Name = chapterName.Text
            };
            pgc.Chapters.Insert(intIndex, c);
            FreshChapterView();
            updateTimeLine();
        }
Пример #9
0
        private void configFileTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string configFile = configFileTextBox.Text;

            if (configFile != String.Empty)
            {
                try
                {
                    FileInfo info = new FileInfo(configFile);
                }
                catch (System.Exception exception)
                {
                    configFileTextBox.SelectAll();
                    UserMessage.DisplayFailure(exception, "Invalid Entry");
                    e.Cancel = true;
                }

                if (configFile.IndexOfAny(new char[] { '\\', ':' }) >= 0)
                {
                    configFileTextBox.SelectAll();
                    UserMessage.DisplayFailure("Specify configuration file as filename and extension only", "Invalid Entry");
                    e.Cancel = true;
                }
            }
        }
Пример #10
0
 private void m_txtMedName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ((clsControlMedCommonUse)this.objController).m_mthFind();
         this.m_txtMedName.Focus();
         m_txtMedName.SelectAll();
     }
 }
Пример #11
0
 private void FindForm_Activated(object sender, System.EventArgs e)
 {
     if (m_SelectText)
     {
         m_SelectText = false;
         TextEdit.SelectAll();
         TextEdit.Focus();
     }
 }
Пример #12
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                TextBox1.Focus();
                TextBox1.SelectAll();
                return;
            }
            if (TextBox2.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                TextBox2.Focus();
                TextBox2.SelectAll();
                return;
            }
            if (ComboBox1.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                ComboBox1.Focus();
                ComboBox1.SelectAll();
                return;
            }
            if (frmMode == 0)             //修改记录
            {
                if (MessageBox.Show("确定要修改当前物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (EditData(OldMaterialTypeCode, TextBox1.Text, TextBox2.Text, rms_var.GetDeptCode(ComboBox1.Text), CheckBox1.Checked))
                    {
                        MessageBox.Show("修改记录成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else             //添加记录
            {
                if (AddData(TextBox1.Text, TextBox2.Text, rms_var.GetDeptCode(ComboBox1.Text), CheckBox1.Checked))
                {
                    MessageBox.Show("添加记录成功!");
                    if (MessageBox.Show("继续添加新物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        TextBox1.Text     = "";
                        TextBox2.Text     = "";
                        ComboBox1.Text    = "";
                        CheckBox1.Checked = false;

                        TextBox1.Focus();
                        TextBox1.SelectAll();
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
        }
Пример #13
0
        private void button2_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (textBoxAtaKasa.Text.Length < 1)
                {
                    Utility.Engine.Hata("Once Ata Kasayi Okutun!");
                    textBoxAtaKasa.Text = "";
                    textBoxAtaKasa.Focus();
                    return;
                }
                Utility.Engine.sql = string.Format("EXEC dbo.KasaBulKasaTransfer N'{0}'", Utility.Engine.SqlTemizle(textBoxKasa.Text));

                //ilkinin iş emri vardaiya personel = olursa aktara bilsin

                DataTable dtx = new DataTable();

                Utility.Engine.dat.TableDoldur(Utility.Engine.sql, ref dtx);

                if (dtx != null && dtx.Rows.Count > 0)
                {
                    if (dtx.Rows[0]["DepoKodu"].ToString() != textDepo.Text)
                    {
                        Utility.Engine.Hata("Ata Kasa Depo Bilgisi Ve Kasa Depo Bilgisi Farkli Transfer Edilemez!");
                        textBoxKasa.Focus();
                        textBoxKasa.SelectAll();
                        return;
                    }
                    comboBoxEkleSil.SelectedIndex = 0;
                    textBoxKasa.Text      = dtx.Rows[0]["SeriliBarkod"].ToString();
                    textKasaStokKodu.Text = dtx.Rows[0]["StokKodu"].ToString();
                    textKasaStokAdi.Text  = dtx.Rows[0]["StokAdi"].ToString();
                    textKasaBirim.Text    = dtx.Rows[0]["Birim"].ToString();
                    textKMiktar.Text      = Convert.ToDecimal(dtx.Rows[0]["Miktar"].ToString()).ToString();
                    textMiktar.Focus();
                    return;
                }
                else
                {
                    Temizle();
                    Utility.Engine.Hata("Seri Bilgisi Sistemde Bulunamadi!");
                    textBoxKasa.Focus();
                    textBoxKasa.SelectAll();
                    return;
                }
            }
            catch (Exception exc)
            {
                Utility.Engine.Hata("Seri Sorgulanamadi.");
                textBoxKasa.Focus();
                textBoxKasa.SelectAll();
                return;
            }
        }
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (inputPanel1.Enabled == true)
     {
         inputPanel1.Enabled = false;
     }
     else
     {
         ShowInputPanel();
     }
     ilosc_t.SelectAll();
 }
Пример #15
0
        /// \ifnot hide_events
        /// Performs KeyPress analysis and handling to ensure a valid ip octet is
        /// being entered in Box1.
        /// \endif
        private void Box1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            //Only Accept a '.', a numeral, or backspace
            if (e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
            {
                //If the key pressed is a '.'
                if (e.KeyChar.ToString() == ".")
                {
                    //If the Text is a valid ip octet move to the next box
                    if (Box1.Text != "" && Box1.Text.Length != Box1.SelectionLength)
                    {
                        if (IsValid(Box1.Text))
                        {
                            Box2.Focus();
                        }
                        else
                        {
                            Box1.SelectAll();
                        }
                    }
                    e.Handled = true;
                }

                //If we are not overwriting the whole text
                else if (Box1.SelectionLength != Box1.Text.Length)
                {
                    //Check that the new Text value will be a valid
                    // ip octet then move on to next box
                    if (Box1.Text.Length == 2)
                    {
                        if (e.KeyChar == 8)
                        {
                            Box1.Text.Remove(Box1.Text.Length - 1, 1);
                        }
                        else if (!IsValid(Box1.Text + e.KeyChar.ToString()))
                        {
                            Box1.SelectAll();
                            e.Handled = true;
                        }
                        else
                        {
                            Box2.Focus();
                        }
                    }
                }
            }
            //Do nothing if the keypress is not numeral, backspace, or '.'
            else
            {
                e.Handled = true;
            }
        }
Пример #16
0
 /// \ifnot hide_events
 /// Performs KeyPress analysis and handling to ensure a valid ip octet is
 /// being entered in Box2.
 /// \endif
 private void Box2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     //Similar to Box1_KeyPress but in special case for backspace moves cursor
     //to the previouse box (Box1)
     if (e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
     {
         if (e.KeyChar.ToString() == ".")
         {
             if (Box2.Text != "" && Box2.Text.Length != Box2.SelectionLength)
             {
                 if (IsValid(Box1.Text))
                 {
                     Box3.Focus();
                 }
                 else
                 {
                     Box2.SelectAll();
                 }
             }
             e.Handled = true;
         }
         else if (Box2.SelectionLength != Box2.Text.Length)
         {
             if (Box2.Text.Length == 2)
             {
                 if (e.KeyChar == 8)
                 {
                     Box2.Text.Remove(Box2.Text.Length - 1, 1);
                 }
                 else if (!IsValid(Box2.Text + e.KeyChar.ToString()))
                 {
                     Box2.SelectAll();
                     e.Handled = true;
                 }
                 else
                 {
                     Box3.Focus();
                 }
             }
         }
         else if (Box2.Text.Length == 0 && e.KeyChar == 8)
         {
             Box1.Focus();
             Box1.SelectionStart = Box1.Text.Length;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
Пример #17
0
 /// \ifnot hide_events
 /// Performs KeyPress analysis and handling to ensure a valid ip octet is
 /// being entered in Box3.
 /// \endif
 private void Box3_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     //Identical to Box2_KeyPress except that previous box is Box2 and
     //next box is Box3
     if (e.KeyChar.ToString() == "." || Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
     {
         if (e.KeyChar.ToString() == ".")
         {
             if (Box3.Text != "" && Box3.SelectionLength != Box3.Text.Length)
             {
                 if (IsValid(Box1.Text))
                 {
                     Box4.Focus();
                 }
                 else
                 {
                     Box3.SelectAll();
                 }
             }
             e.Handled = true;
         }
         else if (Box3.SelectionLength != Box3.Text.Length)
         {
             if (Box3.Text.Length == 2)
             {
                 if (e.KeyChar == 8)
                 {
                     Box3.Text.Remove(Box3.Text.Length - 1, 1);
                 }
                 else if (!IsValid(Box3.Text + e.KeyChar.ToString()))
                 {
                     Box3.SelectAll();
                     e.Handled = true;
                 }
                 else
                 {
                     Box4.Focus();
                 }
             }
         }
         else if (Box3.Text.Length == 0 && e.KeyChar == 8)
         {
             Box2.Focus();
             Box2.SelectionStart = Box2.Text.Length;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
Пример #18
0
        /// <summary>
        /// Called when the step is activated.
        /// </summary>
        /// <param name="steps">The step list.</param>
        public void OnStepIn(WizardStepList steps)
        {
            this.Show();

            if (serverName.Text.Trim() == string.Empty)
            {
                serverName.Focus();
                serverName.SelectAll();
            }
            else
            {
                adminAccount.Focus();
                adminAccount.SelectAll();
            }
        }
        private void SlopeValidate(object sender, CancelEventArgs e)
        {
            Debug.Assert(sender == txtSlope, "SlopeValidate method called by wrong control");

            try
            {
                int slope = int.Parse(txtSlope.Text);
                if (slope < MinSlope || slope > MaxSlope)
                {
                    err.SetError(txtSlope, "Slope must be between 55 and 155");
                    e.Cancel = true;
                }
            }
            catch
            {
                err.SetError(txtSlope, "BUG: Slope must be an integer");
                e.Cancel = true;
            }

            if (e.Cancel)
            {
                txtSlope.SelectAll();
            }
            else
            {
                err.SetError(txtSlope, "");
            }
        }
        public Form18(string dokus, string kod, string nazwik, string cenik, string ceniksp, string vacik, string wymagane, string zliczone, string statusik, string opak, string jedn, string asorcik, SmartDeviceApplication2.Form17 form17a, int rownumber, int addflag, string ilosc, int id)
        {
            kodzik   = kod;
            indeks   = dokus;
            rownum   = rownumber;
            zliczono = zliczone;
            form17   = form17a;
            czydodac = addflag;
            ebid     = id;
            InitializeComponent();
            this.Height = Screen.PrimaryScreen.Bounds.Height;
            this.Width  = Screen.PrimaryScreen.Bounds.Width;
            Update();

            indeks          = dokus;
            kod_t.Text      = kodzik;
            nazwa_t.Text    = nazwik;
            cena_t.Text     = cenik;
            cenasp_t.Text   = ceniksp;
            vat_t.Text      = vacik;
            wymagane_t.Text = Convert.ToString(decimal.Parse(wymagane) - decimal.Parse(zliczono));
            wopak_t.Text    = opak;
            jm_t.Text       = jedn;
            status_t.Text   = statusik;
            asorcik1        = asorcik;
            zliczono_t.Text = zliczono;
            ilosc_t.Text    = ilosc;
            ilosc_t.Focus();
            ilosc_t.SelectAll();
        }
        public override bool OnCommandEdit()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                SetScreenMode(eScreenMode.Edit);
                ControlUtil.EnabledControl(true, grpAddEdit.Controls);

                txtGroupName.Focus();
                txtGroupName.SelectAll();
                gvResult.Enabled = false;


                DataRow dr = ((DataTable)gvResult.DataSource).Rows[gvResult.CurrentRow.Index];
                dr[(int)eColDetail.UpdateDate] = DateTime.Now;
                dr[(int)eColDetail.UpdateUser] = AppEnvironment.UserLogin;
                return(true);
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(this, ex);
                return(false);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #22
0
 /// \ifnot hide_events
 /// Performs KeyPress analysis and handling to ensure a valid ip octet is
 /// being entered in Box4.
 /// \endif
 private void Box4_KeyPress(object sender, KeyPressEventArgs e)
 {
     //Similar to Box3 but ignores the '.' character and does not advance
     //to the next box.  Also Box3 is previous box for backspace case.
     if (char.IsDigit(e.KeyChar) || e.KeyChar == 8)
     {
         if (Octet4.SelectionLength != Octet4.Text.Length)
         {
             if (Octet4.Text.Length == 2)
             {
                 if (!IsValid(Octet4.Text + e.KeyChar))
                 {
                     Octet4.SelectAll();
                     e.Handled = true;
                 }
             }
         }
         else if (Octet4.Text.Length == 0 && e.KeyChar == 8)
         {
             Octet3.Focus();
             Octet3.SelectionStart = Octet3.Text.Length;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
Пример #23
0
 private void AddNewIdentity()
 {
     this.AddNewIdentity(new UserIdentity());
     PopulateDefaultIdentities();
     txtIdentityName.SelectAll();
     txtIdentityName.Focus();
 }
Пример #24
0
        protected override void OnVisibleChanged(EventArgs e)
        {
            textBoxSearchKeywords.Focus();     // focus on the textbox and
            textBoxSearchKeywords.SelectAll(); // select all to replace text when user types

            base.OnVisibleChanged(e);
        }
Пример #25
0
 private void PropertyView_DoubleClick(object sender, EventArgs e)
 {
     lvItem_ = this.GetItemAt(mx_, my_);
     if (lvItem_ != null)
     {
         int x1 = this.Columns[0].Width + 2;
         if (mx_ >= x1)
         {
             int      x2   = x1 + this.Columns[1].Width;
             int      r    = lvItem_.Index;
             Property prop = (Property)propList_[r];
             if (prop.isSelection())
             {
                 addSelections(prop.getOptions());
                 comboBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height);
                 comboBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 comboBox_.Show();
                 comboBox_.Text = lvItem_.SubItems[1].Text;
                 comboBox_.SelectAll();
                 comboBox_.Focus();
             }
             else
             {
                 editBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height - 2);
                 editBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 editBox_.Show();
                 editBox_.Text = lvItem_.SubItems[1].Text;
                 editBox_.SelectAll();
                 editBox_.Focus();
             }
         }
     }
 }
 private void CompileOptionsForm_Load(object sender, System.EventArgs e)
 {
     // Select first control on the form
     listProtection.SelectedIndex = 0;
     txtFileName.SelectAll();
     txtFileName.Focus();
 }
Пример #27
0
        private bool CheckIfInstanceValueValid()
        {
            if (this._tbInstanceNumber.Text.Length < 1)
            {
                return(false);
            }

            long instanceNumber = Convert.ToInt64(this._tbInstanceNumber.Text);

            //Check if Valid
            if (instanceNumber < 0 || instanceNumber > 2147483647)
            {
                Messager.ShowError(this, "Enter an integer between 1 and 2147483647");
                return(false);
            }

            string label = _tbPresentationLabel.Text;

            if (!VerifyCodeString(label))
            {
                Messager.ShowError(this, "Presentation Label can only contain:\n\nUppercase characters: 'A'-'Z'\nDigits: '0'-'9'\nBlanks (space character)\nUnderscores '_'");
                _tbPresentationLabel.SelectAll();
                _tbPresentationLabel.Focus();
                return(false);
            }



            //Valid
            return(true);
        }
Пример #28
0
        private void okButton_Click(object sender, System.EventArgs e)
        {
            string path = assemblyPathTextBox.Text;

            try
            {
                FileInfo info = new FileInfo(path);

                if (!info.Exists)
                {
                    DialogResult answer = UserMessage.Ask(string.Format(
                                                              "The path {0} does not exist. Do you want to use it anyway?", path));
                    if (answer != DialogResult.Yes)
                    {
                        return;
                    }
                }

                DialogResult = DialogResult.OK;
                this.path    = path;
                this.Close();
            }
            catch (System.Exception exception)
            {
                assemblyPathTextBox.SelectAll();
                UserMessage.DisplayFailure(exception, "Invalid Entry");
            }
        }
Пример #29
0
        private void assemblyPathTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string path = assemblyPathTextBox.Text;

            try
            {
                FileInfo info = new FileInfo(path);

                if (!info.Exists)
                {
                    DialogResult answer = UserMessage.Ask(string.Format(
                                                              "The path {0} does not exist. Do you want to use it anyway?", path));
                    if (answer != DialogResult.Yes)
                    {
                        e.Cancel = true;
                    }
                }
            }
            catch (System.Exception exception)
            {
                assemblyPathTextBox.SelectAll();
                UserMessage.DisplayFailure(exception, "Invalid Entry");
                e.Cancel = true;
            }
        }
Пример #30
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show("会员卡号不能为空!");
                return;
            }
            int cardstatus;

            if (CheckBox1.Checked)
            {
                cardstatus = 1;
            }
            else
            {
                cardstatus = 2;                 //暂停
            }
            if (AddClubCard(CustCode, TextBox1.Text, DateTimePicker1.Value.ToString(), TextBox3.Text, NumericUpDown1.Text, NumericUpDown2.Text, cardstatus.ToString(), TextBox2.Text))
            {
                MessageBox.Show("添加会员卡成功!");
            }
            else
            {
                TextBox1.Focus();
                TextBox1.SelectAll();
            }
        }
Пример #31
0
        protected override void ProcessRecord()
        {
            var files = Directory.GetFiles(SessionState.Path.CurrentLocation.Path, SearchPattern);

            if (files.Length > 0)
            {
                StringBuilder builder = new StringBuilder();

                foreach (var file in files)
                {
                    builder.AppendLine(file);
                }

                TextBox clipStore = new TextBox();
                clipStore.Text = builder.ToString();
                clipStore.Multiline = true;
                clipStore.SelectAll();
                clipStore.Copy();

                WriteObject(string.Format("({0}) files copied.", files.Length));
            }
            else
            {
                WriteError(new ErrorRecord(new NullReferenceException("No Files to copy"), "0301", ErrorCategory.InvalidArgument, files));
            }
        }
Пример #32
0
 /// \ifnot hide_events
 /// Performs KeyPress analysis and handling to ensure a valid ip octet is
 /// being entered in Box4.
 /// \endif
 private void Box4_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     //Similar to Box3 but ignores the '.' character and does not advance
     //to the next box.  Also Box3 is previous box for backspace case.
     if (Char.IsDigit(e.KeyChar) || e.KeyChar == 8)
     {
         if (Box4.SelectionLength != Box4.Text.Length)
         {
             if (Box4.Text.Length == 2)
             {
                 if (e.KeyChar == 8)
                 {
                     Box4.Text.Remove(Box4.Text.Length - 1, 1);
                 }
                 else if (!IsValid(Box4.Text + e.KeyChar.ToString()))
                 {
                     Box4.SelectAll();
                     e.Handled = true;
                 }
             }
         }
         else if (Box4.Text.Length == 0 && e.KeyChar == 8)
         {
             Box3.Focus();
             Box3.SelectionStart = Box3.Text.Length;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
Пример #33
0
        private bool CheckAndParseValue(TextBox textBox, out int value)
        {
            if (int.TryParse(textBox.Text, out value))
                return true;

            MessageBox.Show(this, "Invalid numeric format!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            textBox.SelectAll();
            textBox.Focus();
            return false;
        }
Пример #34
0
        /// <summary>
        /// 檢查文本框的內容是否輸入正確
        /// </summary>
        /// <param name="target"></param>
        /// <param name="textType"></param>
        /// <returns></returns>
        public static bool CheckNumTextBox(TextBox target, enmTextBoxValueType textType, enmNumCheckType checkType)
        {
            switch (textType)
            {
                case enmTextBoxValueType.enmInt:
                    int intValue = 0;
                    if(!int.TryParse(target.Text,out intValue))
                    {
                        target.SelectAll();
                        target.Focus();
                        return false;
                    }

                    if (checkType == enmNumCheckType.enmNotAllowZero && intValue == 0)
                    {
                        target.SelectAll();
                        target.Focus();
                        return false;
                    }

                    break;
                case enmTextBoxValueType.enmDecimal:
                    decimal decValue = 0;
                    if (!decimal.TryParse(target.Text, out decValue))
                    {
                        target.SelectAll();
                        target.Focus();
                        return false;
                    }

                    if (checkType == enmNumCheckType.enmNotAllowZero && decValue == 0)
                    {
                        target.SelectAll();
                        target.Focus();
                        return false;
                    }

                    break;
            }

            return true;
        }
Пример #35
0
 public static bool IsEqualTo(TextBox txt1, TextBox txt2)
 {
     if (txt1.Text == txt2.Text)
     {
         return true;
     }
     MessageBox.Show("Passwords must be equal.");
     txt1.Focus();
     txt1.SelectAll();
     return false;
 }
Пример #36
0
 public static short EhShort(TextBox txt)
 {
     try
     {
         return Convert.ToInt16(txt.Text);
     }
     catch (Exception)
     {
         txt.Focus();
         txt.SelectAll();
         throw new Exception("Informe um ano válido");
     }
 }
Пример #37
0
 //Criar um método para converter em decimal
 private decimal EhDecimal(TextBox txt)
 {
     try
     {
         return Convert.ToDecimal(txt.Text);
     }
     catch
     {
         txt.Focus();
         txt.SelectAll();
         throw new Exception("Informe apenas números");
     }
 }
Пример #38
0
 public static string TahVazio(TextBox txt)
 {
     if (txt.Text.Trim() != "")
     {
         return txt.Text;
     }
     else
     {
         txt.Focus();
         txt.SelectAll();
         throw new Exception("Preencha " 
             + txt.Name.Substring(0, txt.Name.Length-7));
     }
 }
Пример #39
0
 private void CreateTextBox(LinkLabel label)
 {
     text = new TextBox();
     text.Text = label.Text;
     text.Location = label.Location;
     text.Size = label.Size;
     text.BorderStyle = BorderStyle.FixedSingle;
     text.BackColor = Color.CornflowerBlue;
     mainPanel.Controls.Add(text);
     text.BringToFront();
     text.KeyPress += new KeyPressEventHandler(text_KeyPress);
     text.Focus();
     text.SelectAll();
 }
Пример #40
0
        private bool CheckAndParseValue(TextBox textBox, out string value)
        {
            if (!string.IsNullOrWhiteSpace(textBox.Text))
            {
                value = textBox.Text.Trim();
                return true;
            }

            MessageBox.Show(this, "Invalid name!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            textBox.SelectAll();
            textBox.Focus();

            value = null;
            return false;
        }
Пример #41
0
 public static string EstaVazio(TextBox txt)
 {
     if (txt.Text.Trim() != "")
     {
         return txt.Text;
     }
     else
     {
         txt.Focus();
         txt.SelectAll();
         throw new Exception("Preencha o (a): " +  txt.Name.Substring(3));
         //substring é igual ao mid do VB. Dessa forma, estou especificando para pegar o texto
         //que está depois do txt dos nomes que eu especifico. ex: txtNome, txtModelo
         //se meu padrão de nomes fosse nomeTextBox usaria: txt.Name.Substring(0, txtName.Length - 7));
     }
 }
Пример #42
0
 public static bool IsInt(TextBox textBox)
 {
     if (IsPresent(textBox))
     {
         try
         {
             Convert.ToInt32(textBox.Text);
             return true;
         }
         catch (FormatException)
         {
             MessageBox.Show(string.Format("{0} must be an integer number.", textBox.Tag), Title);
             textBox.Focus();
             textBox.SelectAll();
         }
     }
     return false;
 }
Пример #43
0
        public void ValidarCPF(TextBox txt, Label lbl)
        {
            int soma = 0;
            string dv = "";

            if (txt.Text.Length != 11)
            {
                lbl.BackColor = Color.Orange;
                lbl.ForeColor = Color.Red;
                lbl.Text = "I N C O N S I S T E N T E";
            }
            else
            {
                //1º DV
                for (int i = 8; i >= 0; i--)
                {
                    soma += Convert.ToInt32(txt.Text.Substring(i, 1)) * (i + 1);
                }
                dv = Convert.ToString(soma % 11 % 10);

                //2º DV
                soma = 0;
                for (int i = 9; i >= 1; i--)
                {
                    soma += Convert.ToInt32(txt.Text.Substring(i, 1)) * i;
                }
                dv += Convert.ToString(soma % 11 % 10);

                if (dv == txt.Text.Substring(9, 2))
                {
                    lbl.BackColor = Color.Green;
                    lbl.ForeColor = Color.Yellow;
                    lbl.Text = "V Á L I D O";
                }
                else
                {
                    lbl.BackColor = Color.Red;
                    lbl.ForeColor = Color.White;
                    lbl.Text = "N Ã O  V Á L I D O";
                }
                txt.Focus();
                txt.SelectAll();
            }
        }
Пример #44
0
 public static bool IsEmail(TextBox textBox)
 {
     if (IsPresent(textBox))
     {
         try
         {
             MailAddress address = new MailAddress(textBox.Text);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + " [email protected]");
             textBox.Focus();
             textBox.SelectAll();
             return false;
         }
         return true;
     }
     return false;
 }
Пример #45
0
        /// <summary>
        /// 输入对话框
        /// </summary>
        /// <param name="caption">标题</param>
        /// <param name="hint">提示内容</param>
        /// <param name="Default">默认值</param>
        /// <returns></returns>
        public static string InputBox(string caption, string hint, string Default)
        {
            Form inputForm = new Form
            {
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Width = 220,
                Height = 150,
                Text = caption
            };

            Label lbl = new Label { Text = hint, Left = 10, Top = 20, Parent = inputForm, AutoSize = true };
            TextBox tb = new TextBox { Left = 30, Top = 45, Width = 160, Parent = inputForm, Text = Default };
            tb.SelectAll();
            Button btnok = new Button { Left = 30, Top = 80, Parent = inputForm, Text = "确定" };
            inputForm.AcceptButton = btnok;//回车响应

            btnok.DialogResult = DialogResult.OK;
            Button btncancal = new Button
            {
                Left = 120,
                Top = 80,
                Parent = inputForm,
                Text = "取消",
                DialogResult = DialogResult.Cancel
            };
            try
            {
                return inputForm.ShowDialog() == DialogResult.OK ? tb.Text : null;
            }
            finally
            {
                inputForm.Dispose();
            }
        }
Пример #46
0
 private void pushOverflowError( TextBox box )
 {
     box.Clear();
     box.Text = "Overflow";
     box.SelectAll();
 }
Пример #47
0
        static void CreateApplication()
        {
            // Initialize Application
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Default font used in all controls
            var font = new Font("Consolas", 12.0f);

            // ----------------------------------------------------------------
            // Create sample Text Box to be placed into the right panel.
            var textView = new TextBox
            {
                Dock = DockStyle.Fill,
                Font = font,
                HideSelection = false,
                Multiline = true,
                ShortcutsEnabled = true,
                ScrollBars = ScrollBars.Both,
                TabIndex = 1,
                Text = LOREM,
                WordWrap = false,
                // Make sure user cannot change content, since there we don't handle
                // effect of such change in the interactions across controls.
                ReadOnly = true,
            };
            
            // Ctrl-A is not implemented in Text Box control for some reason, so lets add it.
            textView.KeyDown += (sender, eArg) =>
            {
                if (eArg.Control && eArg.KeyCode == Keys.A)
                    textView.SelectAll();
            };

            // ----------------------------------------------------------------
            // Status Label to be placed at the bottom of the Form.
            var statusLabel = new Label
            {
                Dock = DockStyle.Fill,
                Font = font,
                Text = "Status",
                Height = font.Height + 20, // font height + 10px margins
            };

            // ----------------------------------------------------------------
            // Create the Tree View to be placed into the left panel.
            var treeView = new TreeView
            {
                Dock = DockStyle.Fill,
                Font = font,
                TabIndex = 0,
            };
            treeView.AfterSelect +=
                (sender, eArgs) =>
                {
                    var obj = (Tuple<int, int>)eArgs.Node.Tag;
                    statusLabel.Text = textView.Text.Substring(obj.Item1, obj.Item2);
                    textView.SelectionStart = obj.Item1;
                    textView.SelectionLength = obj.Item2;
                    textView.ScrollToCaret();
                };

            // ----------------------------------------------------------------
            // Start from vertically split container that hosts tree view and text box.
            var vertical = new SplitContainer
            {
                Orientation = Orientation.Vertical,
                Font = font,
                Dock = DockStyle.Fill,
                SplitterWidth = 10,
                TabIndex = 2,
            };
            vertical.Panel1.Controls.Add(treeView);
            vertical.Panel2.Controls.Add(textView);

            // Change cursor when dragging splitter
            vertical.SplitterMoving += (sender, eArgs) => { Cursor.Current = Cursors.NoMoveHoriz; };
            vertical.SplitterMoved += (sender, eArgs) => { Cursor.Current = Cursors.Default; };

            // ----------------------------------------------------------------
            // Now horizontally split container to host status label at the bottom panel, and
            // the rest of the controls at the top panel.
            var horizontal = new SplitContainer
            {
                Orientation = Orientation.Horizontal,
                Font = font,
                Dock = DockStyle.Fill,
                SplitterWidth = 10,
                FixedPanel = FixedPanel.Panel2, // Force Status bar to not resize
                IsSplitterFixed = true,
            };
            horizontal.Panel1.Controls.Add(vertical);
            horizontal.Panel2.Controls.Add(statusLabel);

            // Change cursor when dragging splitter
            horizontal.SplitterMoving += (sender, eArgs) => { Cursor.Current = Cursors.NoMoveVert; };
            horizontal.SplitterMoved += (sender, eArgs) => { Cursor.Current = Cursors.Default; };

            // ----------------------------------------------------------------
            // Lastly create top level Form and add horizontally split container to it.
            var form = new Form();
            form.Text = "Winforms template";

            // Initial form size.
            form.ClientSize = new Size { Width = 800, Height = 600 };
            form.Controls.Add(horizontal);

            TextToTree(treeView, textView.Text);

            // Finally, start the main event loop of our application.
            Application.Run(form);
        }
Пример #48
0
        /// <summary>
        /// Sets the foreground color of the label on red or black. Sets focus on the Textbox on first error.
        /// </summary>
        private void SetErrorStatus(TextBox ptbTextBox, Label plLabel, TabPage ptpTabpage, bool pbError)
        {
            plLabel.ForeColor = (pbError) ? Color.Red : Color.Black;

              if (pbError)
              {
            if (!mbInvalidValues)
            {
              tabControl.SelectedTab = ptpTabpage;
              ptbTextBox.Focus();
              ptbTextBox.SelectAll();
            }
            mbInvalidValues = true;
              }
        }
Пример #49
0
 private void bserr_Click(object sender, EventArgs e)
 {
     Form form = new Form();
     form.StartPosition = FormStartPosition.Manual;
     form.Width = base.Width;
     form.Height = base.Height / 4;
     form.Location = this.bserr.PointToScreen(new Point(0, this.bserr.Height));
     form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
     form.Text = "Error message from analiser";
     form.Show(this);
     TextBox textBox = new TextBox();
     textBox.BorderStyle = BorderStyle.None;
     textBox.Multiline = true;
     textBox.Parent = form;
     textBox.Dock = DockStyle.Fill;
     textBox.ScrollBars = ScrollBars.Vertical;
     textBox.BackColor = Color.FromKnownColor(KnownColor.Info);
     textBox.ForeColor = Color.FromKnownColor(KnownColor.InfoText);
     textBox.Text = ((Exception)this.bserr.Tag).ToString();
     textBox.Show();
     Button button = new Button();
     button.Click += new EventHandler(this.buttonCloseMe_Click);
     button.Parent = form;
     button.Text = "Close!";
     form.AcceptButton = button;
     form.CancelButton = button;
     form.Activate();
     textBox.Select();
     textBox.SelectAll();
 }
 private static void SelectAndFocus(TextBox textBox)
 {
     textBox.Focus();
     textBox.SelectAll();
 }
Пример #51
0
        /// <summary>
        /// 输入对话框
        /// </summary>
        /// <param name="caption">标题</param>
        /// <param name="codeImage">图片</param>
        /// <returns></returns>
        public static string InputCodeText(string caption, Image codeImage)
        {
            Form inputForm = new Form
            {
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Width = 220,
                Height = 170,
                Text = caption
            };

            PictureBox imgBox = new PictureBox
            {
                Top = 12,
                Left = 54,
                Width = 100,
                Height = 50,
                Parent = inputForm,
                BorderStyle = BorderStyle.FixedSingle,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image = codeImage
            };

            TextBox tb = new TextBox { Left = 30, Top = 65, Width = 160, Parent = inputForm };
            tb.SelectAll();

            Button btnok = new Button { Left = 30, Top = 100, Parent = inputForm, Text = "确定" };
            inputForm.AcceptButton = btnok;//回车响应

            btnok.DialogResult = DialogResult.OK;
            Button btncancal = new Button
            {
                Left = 120,
                Top = 100,
                Parent = inputForm,
                Text = "取消",
                DialogResult = DialogResult.Cancel
            };
            try
            {
                return inputForm.ShowDialog() == DialogResult.OK ? tb.Text : null;
            }
            finally
            {
                inputForm.Dispose();
            }
        }
Пример #52
0
 private void applyColumnText(TextBox box)
 {
     MySQLTableColumnsListWrapper.MySQLColumnListColumns column = MySQLTableColumnsListWrapper.MySQLColumnListColumns.IsPK;
       switch (box.Tag.ToString())
       {
     case "0":
       column = MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name;
       break;
     case "1":
       column = MySQLTableColumnsListWrapper.MySQLColumnListColumns.Comment;
       break;
     case "2":
       column = MySQLTableColumnsListWrapper.MySQLColumnListColumns.Type;
       break;
     case "3":
       column = MySQLTableColumnsListWrapper.MySQLColumnListColumns.Default;
       break;
       }
       if (column != MySQLTableColumnsListWrapper.MySQLColumnListColumns.IsPK)
       {
     updateColumnTextField(column, box);
     box.SelectAll();
       }
 }
Пример #53
0
    OnInvalidTextBox
    (
        TextBox oTextBox,
        String sErrorMessage
    )
    {
        Debug.Assert(oTextBox != null);
        Debug.Assert(sErrorMessage != null && sErrorMessage != "");

        OnInvalidControl(oTextBox, sErrorMessage);
        oTextBox.SelectAll();
        return (false);
    }
Пример #54
0
        //Event trên Shape
        void shape_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TableShape shape = (TableShape)sender;
            int  indexColumn =0;

            //Bật trạng thái rename lên
            renamedShape = true;

            //Click vào Table Name
            if (e.Y > 0 && e.Y < ShapeSetting.heightPieceShape)
            {
                renamedTableName = true;
                txtRename = new TextBox();
                txtRename.Location = new Point(0, (indexColumn * ShapeSetting.heightPieceShape));
                txtRename.Width = shape.Width;
                txtRename.Text = shape.table.name;
                shape.Controls.Add(txtRename);
                tShapeRenamed = shape;
                txtRename.Focus();
                txtRename.SelectAll();
                txtRename.KeyDown += new KeyEventHandler(txtRename_KeyDown);
            }
            //Duyệt tất cả các Columns
            for (int i = 1; i <= shape.table.columns.Count; i++)
            {
                if (e.Y > (i * ShapeSetting.heightPieceShape) && e.Y < ((i + 1) * ShapeSetting.heightPieceShape))
                {
                    indexColumn = i;
                    break;
                }
            }
            if (indexColumn > 0)
            {
                //Tạo TextBox Rename
                txtRename = new TextBox();
                txtRename.Location= new Point(0, (indexColumn * ShapeSetting.heightPieceShape));
                txtRename.Width = shape.Width;
                txtRename.Text = shape.table.columns[indexColumn - 1].Name;
                shape.Controls.Add(txtRename);
                txtRename.Focus();
                txtRename.SelectAll();
                colRenamed = shape.table.columns[indexColumn - 1]; //Lấy Column đang được Rename

                //Tạo Combox DataType
                cbxDataType = new DataDescription();
                cbxDataType.Location = new Point(shape.Location.X + shape.Width, shape.Location.Y+(indexColumn*ShapeSetting.heightPieceShape));
                this.Controls.Add(cbxDataType);

                this.Controls.SetChildIndex(cbxDataType, 0);

                cbxDataType.cboDataType.SelectedItem = shape.table.columns[indexColumn - 1].DataType;
                cbxDataType.txtLength.Text = shape.table.columns[indexColumn - 1].Length.ToString();
                cbxDataType.chkNull.Checked = shape.table.columns[indexColumn - 1].AlowNull;
                if (shape.table.columns[indexColumn - 1].PrimaryKey)
                {
                    cbxDataType.chkNull.Enabled = false;
                    cbxDataType.chkNull.Checked = false;
                }
                cbxDataType.txtDescription.Text = shape.table.columns[indexColumn - 1].Description;

                //Sinh Event KeyDown trên textBox
                txtRename.KeyDown += new KeyEventHandler(txtRename_KeyDown);
                cbxDataType.btnOK.Click +=new EventHandler(btnOK_Click);
            }
        }
Пример #55
0
        private bool tryParseBoxHex( TextBox box, out string value )
        {
            UInt64 dec;
            value = box.Text;

            if( value.StartsWith( "0x", StringComparison.OrdinalIgnoreCase ) )
            {
                value = value.Substring(2);
            }

            try
            {
                // Try conversion
                dec = Convert.ToUInt64( value, 16 );
                return true;
            }
            catch( OverflowException overflow )
            {
                pushOverflowError( box );
            }
            catch
            {
                box.SelectAll();
            }

            value = String.Empty;
            return false;
        }
Пример #56
0
 /// <summary>
 /// 获得焦点
 /// </summary>
 /// <param name="txtbox"></param>
 private void Txtbox_Focus(TextBox txtbox)
 {
     txtbox.Focus();
     if (0 != txtbox.Text.Trim().Length)
     {
         txtbox.SelectAll();
     }
 }
Пример #57
0
 public static void FocusAndSelectAll(TextBox txt)
 {
     txt.Focus();
     txt.SelectAll();
 }
Пример #58
0
        private void processSearchBoxDisplay(Control parentControl, TextBox searchBox, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.F)
            {
                if (_findBoxVisible)
                {
                    searchBox.Visible = false;
                    if (parentControl.Dock == DockStyle.None)
                    {
                        parentControl.Height += searchBox.Height - 2;
                    }
                    parentControl.Dock = DockStyle.Fill;
                    parentControl.Focus();
                }
                else
                {
                    if (parentControl.Dock == DockStyle.Fill)
                    {
                        parentControl.Height -= searchBox.Height - 2;
                    }
                    parentControl.Dock = DockStyle.None;
                    searchBox.SelectAll();
                    searchBox.Visible = true;
                    searchBox.Focus();
                    searchBox.SelectAll();
                }
                _findBoxVisible = !_findBoxVisible;
            }

            if (e.KeyCode == Keys.Escape)
            {
                searchBox.Visible = false;
                parentControl.Height += searchBox.Height - 2;
                parentControl.Dock = DockStyle.Fill;
                parentControl.Focus();
                _findBoxVisible = false;
            }

        }
Пример #59
0
        // Try to parse input as numerals
        private bool tryParseBoxULong( TextBox box, out UInt64 value )
        {
            try
            {
                value = Convert.ToUInt64( box.Text );

                return true;
            }
            catch( OverflowException overflow )
            {
                pushOverflowError( box );
            }
            catch
            {
                box.SelectAll();
            }
            value = 0;
            return false;
        }
Пример #60
0
		/// <summary>Saves the content of a textbox into an output parameter and creates a message box if the textbox contains invalid data.</summary>
		/// <param name="Box">A textbox control.</param>
		/// <param name="Text">The description of the textbox.</param>
		/// <param name="Page">The tabpage the textbox resides in.</param>
		/// <param name="Range">The allowed number range.</param>
		/// <param name="Value">The output parameter that receives the numeric value of the textbox content.</param>
		/// <returns>A boolean indicating the success of the operation.</returns>
		private bool SaveControlContent(TextBox Box, string Text, TabPage Page, NumberRange Range, out double Value) {
			bool error;
			if (double.TryParse(Box.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out Value)) {
				switch (Range) {
					case NumberRange.Positive:
						error = Value <= 0.0;
						break;
					case NumberRange.NonNegative:
						error = Value < 0.0;
						break;
					default:
						error = false;
						break;
				}
			} else {
				error = true;
			}
			if (error) {
				string prefix;
				switch (Range) {
					case NumberRange.Positive:
						prefix = "positive ";
						break;
					case NumberRange.NonNegative:
						prefix = "non-negative ";
						break;
					default:
						prefix = "";
						break;
				}
				MessageBox.Show(Text + " must be a " + prefix + "floating-point number.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				tabcontrolTabs.SelectedTab = Page;
				Box.SelectAll();
				Box.Focus();
				return false;
			} else {
				return true;
			}
		}