Ejemplo n.º 1
3
 public static void NextFocus(TextBox tb, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && !bEnter)
     {
         bEnter = true;
         tb.Focus();
         tb.SelectAll();
     }
 }
Ejemplo n.º 2
0
        //data validation for textbox presence
        //extra logic for if the textbox is the color textbox
        public bool isPresentTextBox(TextBox textbox, string name)
        {
            if (textbox == txtColor)
            {
                if (textbox.Text == "")
                {
                    MessageBox.Show(name + " is a required field.  Enter N/A if not applicable.", "Error");
                    textbox.Clear();
                    textbox.Focus();
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                if (textbox.Text == "")
                {
                    MessageBox.Show(name + " is a required field", "Error");
                    textbox.Clear();
                    textbox.Focus();
                    return false;
                }
            }

            return true;
        }
Ejemplo n.º 3
0
 // TODO: improve this IsDecimal method
 public bool IsDecimal(TextBox textBox, string name)
 {
     string s = textBox.Text;
     int decimalCount = 0;
     bool validDecimal = true;
     foreach (char c in s)
     {
         if (!(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5'
             || c == '6' || c == '7' || c == '8' || c == '9' || c == '.' || c == '$'
             || c == '%' || c == ',' || c == ' '))
         {
             validDecimal = false;
             break;
         }
         if (c == '.')
         {
             decimalCount++;
         }
     }
     if (validDecimal && decimalCount <= 1)
     {
         return true;
     }
     else
     {
         MessageBox.Show(name + " must be a decimal value.", "Entry Error");
         textBox.Focus();
         return false;
     }
 }
        public static void ValidateHostSiteForm(TextBox txtPath, TextBox txtPort, TextBox txtVirRoot, Form form, Action successHandler)
        {
            if (!Directory.Exists(txtPath.Text))
            {
                TaskDialog.Show("Specified path does not exist.", form.Text, string.Empty, TaskDialogButton.OK,
                                TaskDialogIcon.Information);

                txtPath.Focus();
                return;
            }


            int port = 0;

            if (!int.TryParse(txtPort.Text, out port) || port < 0 || port > 65535)
            {
                TaskDialog.Show("Specified port is not possible.", form.Text, "Valid input: 0-65535", TaskDialogButton.OK,
                                TaskDialogIcon.Information);

                txtPort.Focus();
                return;
            }

            if (txtVirRoot.Text.Length == 0 || !txtVirRoot.Text.StartsWith("/"))
            {
                TaskDialog.Show("Invalid virtual root.", form.Text, "It should start with a forward slash (Default: /).", TaskDialogButton.OK,
                TaskDialogIcon.Information);

                txtVirRoot.Focus();
                return;
            }

            successHandler();
        }
Ejemplo n.º 5
0
        public static void CheckNullValue(TextBox textBox)
        {
            //textBox.ForeColor = Color.Red;
            //textBox.CharacterCasing = CharacterCasing.Normal;
            //textBox.Text = message;
            textBox.Focus();

        }
		public void SetUp()
		{
			m_TextBox = new TextBox();
			m_TextBox.CreateControl();
			m_TextBox.Focus();
			Application.DoEvents();
			m_Handler = new IbusDefaultEventHandler(m_TextBox);
		}
Ejemplo n.º 7
0
 public static bool IsPresent(TextBox textBox, string name)
 {
     if (textBox.Text == "") {
         MessageBox.Show(name + " is a required field", "Input Error");
         textBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 8
0
        public static DialogResult Show(string title, string promptText, ref string value,
                                        InputBoxValidation validation)
        {
            Form form = new Form();
            Label label = new Label();
            TextBox textBox = new TextBox();
            Button buttonOk = new Button();
            Button buttonCancel = new Button();

            form.Text = title;
            label.Text = promptText;
            textBox.Text = value;

            buttonOk.Text = "OK";
            buttonCancel.Text = "Cancel";
            buttonOk.DialogResult = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            label.SetBounds(9, 20, 372, 13);
            textBox.SetBounds(12, 36, 372, 20);
            buttonOk.SetBounds(228, 72, 75, 23);
            buttonCancel.SetBounds(309, 72, 75, 23);

            label.AutoSize = true;
            textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
            buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
            form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.MinimizeBox = false;
            form.MaximizeBox = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;
            if (validation != null)
            {
                form.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    if (form.DialogResult == DialogResult.OK)
                    {
                        string errorText = validation(textBox.Text);
                        if (e.Cancel = (errorText != ""))
                        {
                            MessageBox.Show(form, errorText, "Validation Error",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                            textBox.Focus();
                        }
                    }
                };
            }
            DialogResult dialogResult = form.ShowDialog();
            value = textBox.Text;
            return dialogResult;
        }
Ejemplo n.º 9
0
 public static bool CheckTextBoxEmpty(TextBox tb)
 {
     if (string.IsNullOrWhiteSpace(tb.Text.Trim()))
     {
         tb.Focus();
          return false;
     }
     return true;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Indicates whether the all Specified TextBoxes are not Empty/Null.
 /// </summary>
 /// <param name="Textbox">Textbox</param>
 /// <returns>
 /// Boolean Value
 /// </returns>
 public static bool IsValidTextBox(TextBox Textbox)
 {
     if (string.IsNullOrEmpty(Textbox.Text))
     {
         Textbox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 11
0
 public TextBox EditTextbox(TextBox txt)
 {
     if (txt.Text.ToUpper() != "VIC")
     {
         txt.Text = "Not the name I was expecting!";
         txt.Focus();
     }
     return txt;
 }
Ejemplo n.º 12
0
 public void Parse(TextBox tb)
 {
     int number;
     if (!Int32.TryParse(tb.Text, out number)) {
         MessageBox.Show("Vul een getal in!");
         tb.Text = "";
         tb.Focus();
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Muestra el 'InputTextBox'
        /// </summary>
        /// <param name="strTexto"> Texto a mostrar en el mensaje </param>
        /// <param name="strEncabezado"> Título del InputTextBox </param>
        /// <param name="strValor"> Texto ingresado </param>
        /// <param name="itbValidacion"> Delegado que valida lo ingresado en el InputTextBox </param>
        /// <returns>DialogResult</returns>
        public static DialogResult Show(string strTexto, string strEncabezado, ref string strValor, InputBoxValidation itbValidacion)
        {
            Form frmFormulario = new Form();
            Label lblEtiqueta = new Label();
            TextBox txtCajaTexto = new TextBox();
            Button btnOK = new Button();
            Button btnCancel = new Button();

            frmFormulario.Text = strEncabezado;
            lblEtiqueta.Text = strTexto;
            txtCajaTexto.Text = strValor;

            btnOK.Text = "OK";
            btnCancel.Text = "Cancel";
            btnOK.DialogResult = DialogResult.OK;
            btnCancel.DialogResult = DialogResult.Cancel;

            lblEtiqueta.SetBounds(9, 20, 372, 13);
            txtCajaTexto.SetBounds(12, 36, 372, 20);
            btnOK.SetBounds(228, 72, 75, 23);
            btnCancel.SetBounds(309, 72, 75, 23);

            lblEtiqueta.AutoSize = true;
            txtCajaTexto.Anchor = txtCajaTexto.Anchor | AnchorStyles.Right;
            btnOK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
            btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            frmFormulario.ClientSize = new Size(396, 107);
            frmFormulario.Controls.AddRange(new Control[] { lblEtiqueta, txtCajaTexto, btnOK, btnCancel });
            frmFormulario.ClientSize = new Size(Math.Max(300, lblEtiqueta.Right + 10), frmFormulario.ClientSize.Height);
            frmFormulario.FormBorderStyle = FormBorderStyle.FixedDialog;
            frmFormulario.StartPosition = FormStartPosition.CenterScreen;
            frmFormulario.MinimizeBox = false;
            frmFormulario.MaximizeBox = false;
            frmFormulario.AcceptButton = btnOK;
            frmFormulario.CancelButton = btnCancel;
            if (itbValidacion != null)
            {
                frmFormulario.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    if (frmFormulario.DialogResult == DialogResult.OK)
                    {
                        string errorText = itbValidacion(txtCajaTexto.Text);
                        if (e.Cancel = (errorText != ""))
                        {
                            MessageBox.Show(frmFormulario, errorText, "Mensaje",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                            txtCajaTexto.Focus();
                        }
                    }
                };
            }
            DialogResult dialogResult = frmFormulario.ShowDialog();
            strValor = txtCajaTexto.Text;
            return dialogResult;
        }
Ejemplo n.º 14
0
 //method to check for blank required fields
 public static bool ContainsData(TextBox textBox, string name)
 {
     if (textBox.Text == "")
     {
         MessageBox.Show(name + " cannot be blank. Please fill in the textbox and resubmit.", Title);
         textBox.Focus();
         return false;
     }
     return true;
  }
Ejemplo n.º 15
0
 //method to check for blank mileage total box
 public static bool MileageDollarsContainsData(TextBox textBox)
 {
     if (textBox.Text == "")
     {
         MessageBox.Show("You must click on the calculate button to get your mileage total before submitting.", Title);
         textBox.Focus();
         return false;
     }
     return true;
 }
 private void Validationfieldnumamount(TextBox textBoxControl1)
 {
     Regex rx = new Regex("[^0-9|^.|^\t]");
     if (rx.IsMatch(textBoxControl1.Text))
     {
         textBoxControl1.Text = string.Empty;
         textBoxControl1.Focus();
         throw new Exception("Enter Number only!");
     }
 }
Ejemplo n.º 17
0
 public bool IsPresent(TextBox textbox, string name)
 {
     if (textbox.Text == "")
     {
         MessageBox.Show(name + " is a reqired field.", "Entry Error:");
         textbox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 18
0
 //check if a value has been entered
 public static bool IsPresent(TextBox textBox, string name)
 {
     if (textBox.Text == "") // check if string is empty
     {
         MessageBox.Show(name + " field cannot be empty", "Entry Error");
         textBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 19
0
 public static bool IsPresent(TextBox textBox)
 {
     if (textBox.Text == "")
     {
         MessageBox.Show(textBox.Tag + " is a required field.", Title);
         textBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 20
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;
        }
Ejemplo n.º 21
0
 void FindNext(TextBox X,TextBox Y)
 {
     int vtbd = X.Text.IndexOf(X.SelectedText);
     //string chuoicl = "";
     //if(vtbd-Y.TextLength>0)
     string     chuoicl = X.Text.Remove(0, vtbd+ Y.TextLength);
     vtbd += chuoicl.IndexOf(Y.Text) + Y.TextLength;
     X.Select(vtbd, Y.TextLength);
     X.Focus();
 }
Ejemplo n.º 22
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;
        }
Ejemplo n.º 23
0
 public bool IsWithinRange(TextBox textBox, string name, decimal min, decimal max)
 {
     decimal number = Convert.ToDecimal(textBox.Text);
     if (number < min || number > max)
     {
         MessageBox.Show(name + " must be between " + min + " and " + max + ".", "Entry Error");
         textBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 24
0
 public static bool Validacion(TextBox Vacio, ErrorProvider error, string mensaje)
 {
     bool valido = false;
     if (Vacio.Text.Trim().Length == 0)
     {
         error.SetError(Vacio, mensaje);
         Vacio.Focus();
         valido = false;
     }
     return valido;
 }
        public bool IsPresent(TextBox textBox)
        {
            if (textBox.Text == "")
            {
                MessageBox.Show("ej tomma fält");
                textBox.Focus();
                return false;
            }

            return true;
        }
Ejemplo n.º 26
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;
 }
Ejemplo n.º 27
0
        public static bool IsFolderExist(TextBox textBox, string name)
        {
            if (!Directory.Exists(textBox.Text))
            {
                    MessageBox.Show(name + " ne postoji.", "Mapa ne postoji", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox.Focus();
                    return false;

            }
            return true;
        }
        public override bool IsRSS(TextBox textBox)
        {
            if (textBox.Text != "" && textBox.Text.Contains("/rss"))
            {
                return true;
            }
            MessageBox.Show("Fältet får inte vara tomt och måste innhehålla /Rss");
            textBox.Focus();

            return false;
        }
Ejemplo n.º 29
0
        public static bool IsInteger(TextBox textBox, string name)
        {
            int score;

            if (!int.TryParse(textBox.Text, out score)) {
                MessageBox.Show(name + " must be a valid whole number", "Input Error");
                textBox.Focus();
                return false;
            }
            return true;
        }
Ejemplo n.º 30
0
        public static bool IsFileExist(TextBox textBox, string name)
        {
            if (!File.Exists(textBox.Text))
            {
                MessageBox.Show(name + " ne postoji.", "Datoteka ne postoji", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox.Focus();
                return false;

            }
            return true;
        }
 private void okButton_Click(object sender, EventArgs e)
 {
     result = ServiceInstallerDialogResult.OK;
     if (passwordEdit.Text == confirmPassword.Text)
     {
         DialogResult = DialogResult.OK;
     }
     else
     {
         DialogResult = DialogResult.None;
         MessageBox.Show(Res.GetString(Res.Label_MissmatchedPasswords), Res.GetString(Res.Label_SetServiceLogin), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         passwordEdit.Text    = string.Empty;
         confirmPassword.Text = string.Empty;
         passwordEdit.Focus();
     }
     // Consider, V2, jruiz: check to make sure the password is correct for the given account.
 }
Ejemplo n.º 32
0
        private void InsertFormatIntoFilenameTemplate(object sender, EventArgs e)
        {
            int iSelectionStart = _txtFilenameTemplate.SelectionStart;
            string sFilenameTemplate = _txtFilenameTemplate.Text;

            if (_txtFilenameTemplate.SelectionLength > 0)
            {
                sFilenameTemplate = sFilenameTemplate.Remove(iSelectionStart,
                                                             _txtFilenameTemplate.SelectionLength);
            } // end if

            _txtFilenameTemplate.Text = sFilenameTemplate.Insert(iSelectionStart,
                                                                 "{" + ((MenuItem)sender).Text + "}");
            _txtFilenameTemplate.SelectionLength = 0;
            _txtFilenameTemplate.SelectionStart = iSelectionStart + ((MenuItem)sender).Text.Length + 2;
            _txtFilenameTemplate.Focus();
        }
Ejemplo n.º 33
0
 void listBox_MouseClick(object sender, MouseEventArgs e)
 {
     if (Value_Ini == this.listBox.SelectedIndex)
     {
         Value_Change = false;
     }
     else
     {
         Value_Change = true;
     }
     Value_Ini            = this.listBox.SelectedIndex;
     this.textBox.Text    = this.listBox.SelectedItem.ToString();
     this.Height          = 2 + this.textBox.Height + 2;
     this.listBox.Visible = false;
     Fold = true;
     textBox.Focus();
 }
Ejemplo n.º 34
0
        // create a edit box. The listbox item text message has been assigned
        // to the edit box text.
        private void CreateEditBox(object sender)
        {
            courseListListBox = (ListBox)sender;
            int       itemSelected = courseListListBox.SelectedIndex;
            Rectangle r            = courseListListBox.GetItemRectangle(itemSelected);
            string    itemText     = (string)courseListListBox.Items[itemSelected];

            editBox.Location = new System.Drawing.Point(r.X + 10, r.Y + 10);
            editBox.Size     = new System.Drawing.Size(r.Width - 10, r.Height - 10);
            editBox.Show();
            courseListListBox.Controls.AddRange(new System.Windows.Forms.Control[] { this.editBox });
            editBox.Text = itemText;
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new System.EventHandler(this.FocusOver);
        }
Ejemplo n.º 35
0
        public void Goto(int nLine)
        {
            int offset = 0;

            nLine = Math.Min(nLine, tbCode.Lines.Length);               // don't go off the end

            for (int i = 0; i < nLine - 1 && i < tbCode.Lines.Length; ++i)
            {
                offset += (this.tbCode.Lines[i].Length + 2);
            }

            Control savectl = this.ActiveControl;

            tbCode.Focus();
            tbCode.Select(offset, this.tbCode.Lines[nLine > 0? nLine - 1: 0].Length);
            this.ActiveControl = savectl;
        }
Ejemplo n.º 36
0
        private void ImageExportForm_Load(object sender, System.EventArgs e)
        {
            fileTextBox.Text = m_selectedFileName.Length > 0 ? m_selectedFileName : m_hintToBrowse;             // will invoke fileTextBox_TextChanged()

            if (width <= whMin || height <= whMin)
            {
                width = PictureManager.This.Width;
            }

            height = (int)Math.Round((double)width * (double)PictureManager.This.Height / (double)PictureManager.This.Width);

            widthTextBox.Text  = "" + width;
            heightTextBox.Text = "" + height;

            fileTextBox.SelectAll();
            fileTextBox.Focus();
        }
Ejemplo n.º 37
0
 public void FindPanel()
 {
     pnl_Find.Visible = true;
     if (pnl_Find.Height == 90)
     {
         pnl_Find.Height = 0;
     }
     else
     {
         while (pnl_Find.Height < 90)
         {
             pnl_Find.Height = pnl_Find.Height + 5;
             pnl_Find.Refresh();
             txtSearch.Focus();
         }
     }
 }
Ejemplo n.º 38
0
        bool iscorrect(System.Windows.Forms.TextBox c, String text)
        {
            bool ret = true;

            try
            {
                Decimal i = Convert.ToDecimal(c.Text);
            }
            catch (FormatException ex)
            {
                error.SetError(c, text);
                c.Focus();
                ret = false;
            }

            return(ret);
        }
Ejemplo n.º 39
0
        private void keyboardSearchControl1_UserKeyPressed(object sender, AceSoft.KeyBoardHook.KeyboardEventArgs e)
        {
            if (txtSelectedTexBox == null)
            {
                txtContact.Focus();
            }
            else if (txtSelectedTexBox.Name == txtAmount.Name)
            {
                txtAmount.Focus();
            }
            else if (txtSelectedTexBox.Name == txtRemarks.Name)
            {
                txtRemarks.Focus();
            }

            SendKeys.Send(e.KeyboardKeyPressed);
        }
Ejemplo n.º 40
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (txtuser.Text.Equals(""))
            {
                MessageBox.Show("Please Enter User Name", "Library Management", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (txtpwd.Text.Equals(""))
            {
                MessageBox.Show("Please Enter Password", "Library Management", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            bool IsSuccesfulLogin = false;

            try
            {
                // Validates User
                IsSuccesfulLogin = Globals.ValidateId(txtuser.Text, txtpwd.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Library Management", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                this.Dispose();
                Application.Exit();
                return;
            }
            if (!IsSuccesfulLogin)
            {
                MessageBox.Show("Please Enter Valid User Name/Password Combination", "Library Management", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtpwd.Text  = "";
                txtuser.Text = "";
                txtuser.Focus();
                return;
            }
            else
            {
                Globals.UserName = txtuser.Text;
                Globals.Password = txtpwd.Text;
                // Launch Action Form
                this.Close();
                this.Dispose();
                Actions act = new Actions();
                act.ShowDialog();
            }
        }
Ejemplo n.º 41
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (textBox1.Text == "")
            {
                return;
            }
            string strAdd = textBox1.Text;

            if (listBox1.FindString(strAdd, -1) < 0)
            {
                listBox1.Items.Add(strAdd);
                textBox1.Text = "";
                textBox1.Focus();
                return;
            }
            MessageBox.Show("\"" + strAdd + "\" is already in the list box", "Duplicate");
        }
Ejemplo n.º 42
0
    private void ClearFields()
    {
        txtFindRecordNumber.Text = "";
        txtFirstName.Text        = "";
        txtLastName.Text         = "";
        txtAddr1.Text            = "";
        txtAddr2.Text            = "";
        txtCity.Text             = "";
        txtState.Text            = "";
        txtZip.Text         = "";
        txtLastContact.Text = "";

        txtDateReceived.Text = "";
        txtDateSent.Text     = "";

        txtLastName.Focus();
    }
Ejemplo n.º 43
0
 private void txtFactor_TextChanged(object sender, System.EventArgs e)
 {
     //Validate factor
     try
     {
         if (txtFactor.Text != "")
         {
             Convert.ToInt32(txtFactor.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Distance Correction Factor should be a numeric value", "Distance Correction Factor");
         txtFactor.Text = "";
         txtFactor.Focus();
     }
 }
Ejemplo n.º 44
0
 private void txtStreamCount_TextChanged(object sender, System.EventArgs e)
 {
     //Validate tolerance
     try
     {
         if (txtStreamCount.Text != "")
         {
             Convert.ToInt32(txtStreamCount.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Stream count should be a numeric value", "Error Stream Count");
         txtStreamCount.Text = "";
         txtStreamCount.Focus();
     }
 }
Ejemplo n.º 45
0
 private void txtSketchWidth_TextChanged(object sender, System.EventArgs e)
 {
     //Validate sketch width
     try
     {
         if (txtSketchWidth.Text != "")
         {
             Convert.ToInt32(txtSketchWidth.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Sketch width should be a numeric value", "Error sketch width");
         txtSketchWidth.Text = "";
         txtSketchWidth.Focus();
     }
 }
Ejemplo n.º 46
0
 private void txtTolerance_TextChanged(object sender, System.EventArgs e)
 {
     //Validate tolerance
     try
     {
         if (txtTolerance.Text != "")
         {
             Convert.ToInt32(txtTolerance.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Sticky Move Tolerance should be a numeric value", "Sticky Move Tolerance");
         txtTolerance.Text = "";
         txtTolerance.Focus();
     }
 }
Ejemplo n.º 47
0
 private void btnEdit_Click(object sender, System.EventArgs e)
 {
     if (txtNewPass.Text != txtConfirmPass.Text)
     {
         string str  = WorkingContext.LangManager.GetString("frmChangePass_Error1_Messa");
         string str1 = WorkingContext.LangManager.GetString("frmChangePass_Error1_Title");
         //MessageBox.Show("Mật khẩu xác nhận không đúng mật khẩu mới!","lỗi",MessageBoxButtons.OK,MessageBoxIcon.Error);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtNewPass.Text     = "";
         txtConfirmPass.Text = "";
         txtNewPass.Focus();
     }
     else
     {
         ChangePass(txtUserName.Text, txtNewPass.Text);
     }
 }
Ejemplo n.º 48
0
 private void txtOffset_TextChanged(object sender, System.EventArgs e)
 {
     //Validate offset
     try
     {
         if (txtOffset.Text != "")
         {
             Convert.ToInt32(txtOffset.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Correction offset should be a numeric value", "Correction Offset");
         txtOffset.Text = "";
         txtOffset.Focus();
     }
 }
Ejemplo n.º 49
0
 private void txtPrecision_TextChanged(object sender, System.EventArgs e)
 {
     //Validate precision
     try
     {
         if (txtPrecision.Text != "")
         {
             Convert.ToInt32(txtPrecision.Text);
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Unit precision should be a numeric value", "Unit Precision");
         txtPrecision.Text = "";
         txtPrecision.Focus();
     }
 }
Ejemplo n.º 50
0
        public void SMKDoubleClick(object sender, System.EventArgs e)
        {
            // Check the subitem clicked .
            int nStart = X;
            int spos   = 0;
            int epos   = this.Columns[0].Width;

            for (int i = 0; i < this.Columns.Count; i++)
            {
                if (nStart > spos && nStart < epos)
                {
                    subItemSelected = i;
                    break;
                }

                spos  = epos;
                epos += this.Columns[i].Width;
            }

            Console.WriteLine("SUB ITEM SELECTED = " + li.SubItems[subItemSelected].Text);
            subItemText = li.SubItems[subItemSelected].Text;

            string colName = this.Columns[subItemSelected].Text;

            if (colName == "Continent")
            {
                Rectangle r = new Rectangle(spos, li.Bounds.Y, epos, li.Bounds.Bottom);
                cmbBox.Size     = new System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top);
                cmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                cmbBox.Show();
                cmbBox.Text = subItemText;
                cmbBox.SelectAll();
                cmbBox.Focus();
            }
            else
            {
                Rectangle r = new Rectangle(spos, li.Bounds.Y, epos, li.Bounds.Bottom);
                editBox.Size     = new System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top);
                editBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                editBox.Show();
                editBox.Text = subItemText;
                editBox.SelectAll();
                editBox.Focus();
            }
        }
Ejemplo n.º 51
0
        /// <summary>
        /// Executa a consulta pelo nome.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, System.EventArgs e)
        {
            try
            {
                clRegras regras = new clRegras();
                regras.IniciarTransacao();
                String SQL = regras.Query2(textBox1.Text);

                if (textBox1.Text.Length > 100)
                {
                    MessageBox.Show("Máximo 100 caracteres !", "Consulta", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox1.Focus();
                }
                else if (textBox1.Text.Length < 1)
                {
                    //String SQLTudo = regras.QueryTudo();
                    dataGrid1.DataSource = regras.Consulta(textBox1.Text.ToString().Trim());

                    //Cria-se um Data Set aqui para a hora que vc ecolher no
                    //dataGrid o RecordSet do DataSet esteza com o conteudo a
                    //ser selecionado.
                    dataSet1 = regras.CriaDataSet();
                    regras.FazerTransacao();
                }
                else if (regras.Consulta(textBox1.Text.ToString().Trim()) != null)
                {
                    dataGrid1.DataSource = regras.Consulta(textBox1.Text.ToString().Trim());

                    //Cria-se um Data Set aqui para a hora que vc ecolher no
                    //dataGrid o RecordSet do DataSet esteza com o conteudo a
                    //ser selecionado.
                    dataSet1 = regras.CriaDataSet();
                    regras.FazerTransacao();
                }
                else
                {
                    MessageBox.Show("Nenhum registro encontrado !", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    dataGrid1.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 52
0
        private void btnSaveSampleCharacter_Click(object sender, System.EventArgs e)
        {
            if (txtSampleCharacter.Text.ToString().Trim() == "")
            {
                MessageBox.Show("样本性状不能为空", "样本信息", MessageBoxButtons.OK);
                txtSampleCharacter.Focus();
                return;
            }
            string strSampleCharacter = txtSampleCharacter.Text.ToString().Trim();
            string strSampleTypeID    = cboSampleType.SelectedValue.ToString().Trim();
            string strPyCode          = txtSampleCharacterPYCode.Text.ToString().Trim();
            string strWbCode          = txtSampleCharacterWBCode.Text.ToString().Trim();
            int    intHasBarCode      = this.m_cboHasBarCode.SelectedIndex;
            string strSEQ             = null;
            long   flag = 0;

            if (btnSaveSampleCharacter.Text == "保存")
            {
                flag = ((clsController_SampleTypeInfo)this.objController).AddNewSampleCharacter(strSampleCharacter, strPyCode, strWbCode, strSampleTypeID, ref strSEQ);
                if (flag > 0)
                {
                    ListViewItem objlsvItem = new ListViewItem();
                    objlsvItem.Text = strSEQ;
                    objlsvItem.SubItems.Add(strSampleCharacter);
                    objlsvItem.SubItems.Add(strPyCode);
                    objlsvItem.SubItems.Add(strWbCode);
                    lsvSampleCharacter.Items.Add(objlsvItem);
                }
            }
            else if (btnSaveSampleCharacter.Text == "修改")
            {
                if (this.lsvSampleCharacter.SelectedItems.Count > 0)
                {
                    strSEQ = lsvSampleCharacter.SelectedItems[0].SubItems[0].Text.ToString().Trim();
                    flag   = ((clsController_SampleTypeInfo)this.objController).SetSampleCharacter(strSampleCharacter,
                                                                                                   strPyCode, strWbCode, strSampleTypeID, strSEQ);
                    if (flag > 0)
                    {
                        lsvSampleCharacter.SelectedItems[0].SubItems[1].Text = txtSampleCharacter.Text;
                        lsvSampleCharacter.SelectedItems[0].SubItems[2].Text = strPyCode;
                        lsvSampleCharacter.SelectedItems[0].SubItems[3].Text = strWbCode;
                    }
                }
            }
        }
Ejemplo n.º 53
0
 private void DisplayText(String data)
 {
     try
     {
         if (this.InvokeRequired)
         {
             object[]     temp = { data };
             IAsyncResult ars  = this.BeginInvoke(new displayMessageDlgt(DisplayText), temp);
             this.EndInvoke(ars);
             return;
         }
         else
         {
             if (data.IndexOf("Username>") != -1)
             {
                 data = data.Substring(0, data.Length - 10);
             }
             String stemp = "";
             if (!data.StartsWith("\r\n"))
             {
                 stemp = "\r\n" + data;
                 data  = stemp;
             }
             if (!data.EndsWith("\r\n"))
             {
                 stemp = data + "\r\n";
                 data  = stemp;
             }
             if (textReaderTalk.TextLength > 32767)
             {
                 textReaderTalk.Text = "... Text removed\r\n";
             }
             textReaderTalk.Text += data;
             this.Cursor          = Cursors.Default;
             textReaderTalk.Focus();
             textReaderTalk.SelectAll();
             textReaderTalk.ScrollToCaret();
             return;
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception in the DiscplayText: " + ex.Message);
     }
 }
Ejemplo n.º 54
0
        private void cmdOk_Click(object sender, System.EventArgs e)
        {
            DataTable dtver = m.get_data("select * from " + user + ".version").Tables[0];

            if (dtver.Rows.Count > 0)
            {
                if (dtver.Rows[0]["medisoft"].ToString().Trim() != "")
                {
                    string tenfile = m.file_exe("medisoft");
                    if (dtver.Rows[0]["medisoft"].ToString().Trim() != m.file_modify(tenfile))
                    {
                        MessageBox.Show("Không đúng version đang sử dụng !", LibMedi.AccessData.Msg);
                        Application.Exit();
                    }
                }
            }
            if (!kiemtra())
            {
                MessageBox.Show(lan.Change_language_MessageText("Tên người dùng và mật khẩu không tìm thấy !"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtuser.Focus();
                return;
            }
            foreach (DataRow r in m.get_data("select makp,capso from " + m.user + ".btdkp_bv where capso>0").Tables[0].Rows)
            {
                if (m.get_data("select * from " + m.user + ".capmabn where yy=" + int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)) + " and loai=2 and userid=" + int.Parse(r["makp"].ToString())).Tables[0].Rows.Count == 0)
                {
                    m.upd_capmabn(int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)), 2, int.Parse(r["makp"].ToString()), int.Parse(r["capso"].ToString()) - 1);
                }
            }
            foreach (DataRow r in m.get_data("select * from " + m.user + ".capmatudong where stt>0").Tables[0].Rows)
            {
                if (m.get_data("select * from " + m.user + ".capmabn where yy=" + int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)) + " and loai=" + int.Parse(r["loai"].ToString()) + " and userid=" + int.Parse(r["loai"].ToString())).Tables[0].Rows.Count == 0)
                {
                    m.upd_capmabn(int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)), int.Parse(r["loai"].ToString()), int.Parse(r["loai"].ToString()), int.Parse(r["stt"].ToString()) - 1);
                }
            }
            if (!m.bMmyy(m.mmyy(m.ngayhienhanh_server)))
            {
                Cursor = Cursors.WaitCursor;
                m.tao_schema(m.mmyy(m.ngayhienhanh_server), iUserid);
                Cursor = Cursors.Default;
            }
            this.mExit = false;
            this.Close();
        }
Ejemplo n.º 55
0
        public Form10(int rownumber, int licence)
        {
            //
            // Required for Windows Form Designer support
            lic = licence;
            InitializeComponent();
            this.Height = Screen.PrimaryScreen.Bounds.Height;
            this.Width  = Screen.PrimaryScreen.Bounds.Width;
            Update();
            string connectionString;

            connectionString = "DataSource=Baza.sdf; Password=matrix1";
            SqlCeConnection cn = new SqlCeConnection(connectionString);

            cn.Open();
            SqlCeDataAdapter da    = new SqlCeDataAdapter("SELECT * FROM dok", cn);
            DataTable        table = new DataTable();

            da.Fill(table);
            index = table.Rows[rownumber][0].ToString();
            SqlCeCommand cmd = cn.CreateCommand();

            cmd.CommandText = "SELECT nazwadok, typ, data, send FROM dok WHERE id = ?";
            cmd.Parameters.Add("@k", SqlDbType.Int);
            cmd.Parameters["@k"].Value = int.Parse(index);
            cmd.Prepare();
            SqlCeDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                nazwa_t.Text   = dr.GetString(0);
                comboBox1.Text = dr.GetString(1);
                data_t.Text    = dr.GetSqlDateTime(2).ToString();
                if (dr.GetBoolean(3) == true)
                {
                    send_c.Checked = dr.GetBoolean(3);
                }
            }
            nazwa_t.Focus();
            data_t.Text = System.DateTime.Now.ToString();
            //
            // TODO: Add any constructor code after InitializeComponent call
            cn.Close();
            //
        }
        public Form9(int licence)
        {
            //
            // Required for Windows Form Designer support
            //


            InitializeComponent();
            this.Height = Screen.PrimaryScreen.Bounds.Height;
            this.Width  = Screen.PrimaryScreen.Bounds.Width;
            Update();
            nazwa_t.Focus();
            data_t.Text = System.DateTime.Now.ToString();
            lic         = licence;
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Ejemplo n.º 57
0
        private void CreateEditBox(object sender)
        {
            listBox      = (ListBox)sender;
            itemSelected = listBox.SelectedIndex;
            Rectangle r        = listBox.GetItemRectangle(itemSelected);
            string    itemText = (string)listBox.Items[itemSelected];

            editBox.Location  = new System.Drawing.Point(r.X + 30, r.Y);
            editBox.Size      = new System.Drawing.Size(r.Width - 150, r.Height - 20);
            editBox.MaxLength = 6;
            editBox.Show();
            listBox.Controls.AddRange(new Control[] { this.editBox });
            editBox.Text = itemText.Remove(0, 5);
            editBox.Focus();
            editBox.SelectAll();
            editBox.KeyPress  += new KeyPressEventHandler(this.EditOver);
            editBox.LostFocus += new EventHandler(this.FocusOver);
        }
Ejemplo n.º 58
0
        private void autoIDBox_CheckedChanged(object sender, System.EventArgs e)
        {
            if (autoIDBox.Checked)
            {
                idTextBox.Text = asset.GetAutoID();
            }
            else
            {
                idTextBox.Text = (asset.ManualID == null) ? asset.GetAutoID() : asset.ManualID;
            }

            Modified();

            if (!autoIDBox.Checked)
            {
                idTextBox.Focus();
            }
        }
Ejemplo n.º 59
0
 private bool ValidateSettings()
 {
   GetSettingsFromControls();
   char[] otherInvalidChars = new char[] { '*', '?' };
   if (Path.IsPathRooted(_settings.ExportPath)
     || _settings.ExportPath.Equals(FILE_EXTENSION_VSCENE, StringComparison.InvariantCultureIgnoreCase)
     || _settings.ExportPath.IndexOfAny(Path.GetInvalidPathChars()) >= 0
     || _settings.ExportPath.IndexOfAny(otherInvalidChars) >= 0)
   {
     EditorManager.ShowMessageBox(
       "The export path is not valid.\nIt must be a file name or a relative path, and it must\nonly contain characters that are allowed in file names.",
       "Export path invalid", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     text_Pathname.Focus();
     return false;
   }
   
   return true;
 }
Ejemplo n.º 60
0
 private void edtCodPais_Leave(object sender, System.EventArgs e)
 {
     if (edtCodPais.Text.Equals("") == false)
     {
         edtPais.Text = RotinasGlobais.Rotinas.ConsultaCampoDesc(ConsCampo,
                                                                 ConsultasSQL.ConsSQL.Pais('S', edtCodPais.Text, ""),
                                                                 "País não encontrado!");
         if (edtPais.Text.Equals(""))
         {
             edtCodPais.Clear();
             edtCodPais.Focus();
         }
     }
     else
     {
         edtPais.Clear();
     }
 }