Clear() public method

public Clear ( ) : void
return void
Example #1
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;
        }
Example #2
0
 public void PrintRadacini(TextBox tb)
 {
     tb.Clear();
     for (int i = 0; i < radacini.Count; i++) {
         tb.AppendText(radacini[i] + "\n");
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            TextBox txtBoxXi = new TextBox();
            txtBoxXi = (TextBox)Controls.Find("txtBoxXi", true).FirstOrDefault();
            TextBox txtBoxYi = new TextBox();
            txtBoxYi = (TextBox)Controls.Find("txtBoxYi", true).FirstOrDefault();

            if (txtBoxXi.Text != "" && txtBoxYi.Text != "")
            {
                if (VerificaSeENumero(txtBoxXi) && VerificaSeENumero(txtBoxYi))
                {
                    listaX.Add(Convert.ToDouble(txtBoxXi.Text));
                    listaY.Add(Convert.ToDouble(txtBoxYi.Text));
                    itm = new ListViewItem(new[] { txtBoxXi.Text, txtBoxYi.Text });
                    listView2.Items.Add(itm);

                    listView2.GridLines = true;
                    listView2.View = View.Details;
                    listView2.FullRowSelect = true;
                    listView2.Update();
                }
                txtBoxXi.Clear();
                txtBoxYi.Clear();
            }
        }
Example #4
0
        public Drawer(TextBox monitor, TextBox resultMonitor, DataGridView grid, DataGridView grid2)
        {
            this._monitor = monitor;
            this._resultMonitor = resultMonitor;
            this._grid = grid;
            this._grid2 = grid2;
            _table = new DataTable();
            _triangularTable = new DataTable();
            _table.Columns.Add("A1", typeof(int));
            _table.Columns.Add("A2", typeof(int));
            _table.Columns.Add("A3", typeof(int));
            _table.Columns.Add("A4", typeof(int));
            _table.Columns.Add("C", typeof(int));
            _triangularTable.Columns.Add("A1", typeof(int));
            _triangularTable.Columns.Add("A2", typeof(int));
            _triangularTable.Columns.Add("A3", typeof(int));
            _triangularTable.Columns.Add("A4", typeof(int));
            _triangularTable.Columns.Add("C", typeof(int));
            grid.DataSource = _table;
            grid2.DataSource = _triangularTable;
            _monitor.Clear();
            _resultMonitor.Clear();

            Solver.UpdateMatrix += SolverUpdateMatrix;
            Solver.UpdateGridRepresentation += Solver_UpdateGridRepresentation;
            Solver.CalculationComplete += Solver_CalculationComplete;
            Solver.ReversePassComplete += Solver_ReversePassComplete;
            Solver.RowsSwaped += Solver_RowsSwaped;
        }
Example #5
0
        //改变文本框读写权限,控制计费类型对应关系
        public void control_readonly(ComboBox s_FeeType, TextBox n_Period, TextBox n_FixMoney,TextBox n_FeeRatio,TextBox n_NumFrom,TextBox n_NumTo)
        {
            if (s_FeeType.Text.Trim() == "按张计费")
            {
                n_Period.ReadOnly = true;
                n_FixMoney.ReadOnly = true;

                n_Period.Clear();
                n_FixMoney.Clear();

                n_FeeRatio.ReadOnly = false;
                n_NumFrom.ReadOnly = false;
                n_NumTo.ReadOnly = false;
            }
            if (s_FeeType.Text.Trim() == "周期性固定计费")
            {
                n_FeeRatio.ReadOnly = true;
                n_NumFrom.ReadOnly = true;
                n_NumTo.ReadOnly = true;

                n_FeeRatio.Clear();
                n_NumFrom.Clear();
                n_NumTo.Clear();

                n_Period.ReadOnly = false;
                n_FixMoney.ReadOnly = false;
            }
        }
Example #6
0
        public static string ShowDialog(string text, string caption, string initalValue="")
        {
            Label textLabel = new Label() { Left = 30, Top = 5, Width = 200, Text = text };
            TextBox textBox = new TextBox() { Left = 30, Top = 35, Width = 200, Text = initalValue };
            Button confirmation = new Button() { Text = "Ok", Left = 105, Width = 70, Top = 80 };
            Button cancel = new Button() { Text = "Cancel", Left = 180, Width = 70, Top = 80 };
            Form prompt = new Form {Text = caption, ShowIcon = false, AcceptButton = confirmation, CancelButton = cancel,
                AutoSize = true, MaximizeBox = false, MinimizeBox = false, AutoSizeMode = AutoSizeMode.GrowAndShrink,
                SizeGripStyle = SizeGripStyle.Hide, ShowInTaskbar = false, StartPosition = FormStartPosition.CenterParent};

            confirmation.Click += (sender, e) =>
                {
                    prompt.DialogResult = DialogResult.OK;
                    prompt.Close();
                };
            cancel.Click += (sender, e) =>
                {
                    textBox.Clear();
                    prompt.DialogResult = DialogResult.Cancel;
                    prompt.Close();
                };

            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(cancel);
            prompt.Controls.Add(textLabel);
            prompt.Controls.Add(textBox);
            prompt.ActiveControl = textBox;

            var result = prompt.ShowDialog();

            return result == DialogResult.OK ? textBox.Text.Trim() : null;
        }
Example #7
0
 private void AddNew(TextBox txtWord, int iListIndex)
 {
     if (string.IsNullOrWhiteSpace(txtWord.Text)) {
         return;
     }
     insults.AddToList(iListIndex, txtWord.Text);
     txtWord.Clear();
 }
Example #8
0
 private void loadIMDBArrayListInfo(IMDb imdb, ArrayList list, TextBox txtBox)
 {
     txtBox.Clear();
     for (int i = 0; i < list.Count; i++)
     {
         txtBox.Text += list[i].ToString() + ", ";
     }
 }
Example #9
0
 public static void FillMemo(TextBox lb, List<string> list)
 {
     lb.Clear();
     foreach(var s in list) {
         if (lb.Text.Length > 0)
         lb.AppendText(Environment.NewLine);
         lb.AppendText(s);
     }
 }
Example #10
0
 private void txtValue_TextChanged(object sender, System.EventArgs e)
 {
     //Prevent user entering no numeric value if querying numeric field
     if (optNumber.Checked == true)
     {
         if (IsDecimal(txtValue.Text) == false)
         {
             txtValue.Clear();
         }
     }
 }
Example #11
0
 private void Undo()
 {
     if (form.Size.Height > rawHeight)
     {
         form.Size = new System.Drawing.Size(form.Size.Width, rawHeight);
         this.pnChangePwd.Hide();
         tbPwd.Clear();
         tbPwd.Focus();
     }
     Application.DoEvents();
 }
Example #12
0
 private void cbUseWinCreds_CheckedChanged(object sender, EventArgs e)
 {
     if (cbUseWinCreds.Checked)
     {
         txtUser.Clear();
         txtPass.Clear();
         this.ClearError(txtUser, null);
         this.ClearError(txtPass, null);
     }
     txtUser.Enabled = txtPass.Enabled = !cbUseWinCreds.Checked;
 }
Example #13
0
        // Creates new, empty document
        public Document(TextBox ScriptTextBox, ListView ListView1)
        {
            m_ScriptTextBox = ScriptTextBox;
            m_ListView1 = ListView1;
            m_FileName = null;
            m_TasksGenerated = false;

            m_ScriptTextBox.Clear(); // Causes OnScriptTextChanged call, but we don't mind
            m_ListView1.Items.Clear();
            m_ScriptTextBox.Modified = false;
        }
Example #14
0
        /// <summary>
        /// Writes the Demo header into the referenced TextBox.
        /// </summary>
        protected virtual void Header()
        {
            if (textHistory != null && 0xFFFF < textHistory.TextLength)
            {
                textHistory.Clear();
            }

            FormDogDemo.WriteToTextbox(textHistory,
                                       "____________________________________________________________\r\n" +
                                       string.Format("API Demo started ({0})\r\n\r\n", DateTime.Now.ToString()));
        }
 private void textQuestion_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         if (textQuestion.Text.Trim() != "")
         {
             button1_Click(null, null);
             textQuestion.Clear();
         }
     }
 }
Example #16
0
        /// <summary>
        /// starts the testing process
        /// </summary>
        public void Run()
        {
            txtOutput.Clear();
            if (tester == null)
            {
                txtOutput.Text = "No Tester assigned!";
            }
            else
            {
                currentTestCase   = 0;
                currentTestMethod = 0;
                totalTestCases    = 0;
                totalTestMethods  = 0;
                txtOutput.Clear();

                startTime         = DateTime.Now;
                tester.Iterations = int.Parse(txtIterations.Text);
                tester.Run();
            }
        }
        private void _addButton_Click(object sender, System.EventArgs e)
        {
            DataTable table           = EditorApp.Instance.RuleSetData.Tables["CityName"];
            DataRow   newRow          = table.NewRow();
            DataRow   civilizationRow = ((DataRowView)this.currencyManager.Current).Row;

            newRow["CivilizationID"] = civilizationRow["civilizationID"];
            newRow["Name"]           = txtCityName.Text;
            table.Rows.Add(newRow);
            txtCityName.Clear();
        }
Example #18
0
 //presence validation
 public bool isPresent(TextBox textbox, string name)
 {
     if (textbox.Text == "")
     {
         MessageBox.Show(name + " is a required field", "Error");
         textbox.Clear();
         textbox.Focus();
         return false;
     }
     return true;
 }
Example #19
0
 private void Limpiar()
 {
     groupBoxdatos.Visible = true;
     txt_DineroActual.Clear();
     txt_DineroCaja.Clear();
     txt_Movimiento.Clear();
     combo_Concepto.ResetText();
     Ultimo_Fondo();
     dateTime_Fecha.Enabled = false;
     combo_Concepto.Enabled = false;
     errorProvider1.Clear();
 }
Example #20
0
            public static void Scan(System.Windows.Forms.TextBox aTextBox, string aHost, string aPortRange, Button aButton)
            {
                openedPorts.Clear();
                closedPorts.Clear();
                scannedCount       = 0;
                runningThreadCount = 0;
                startPort          = 0;
                endPort            = 0;

                string host      = aHost;
                string portRange = aPortRange;

                startPort = int.Parse(portRange.Split('-')[0].Trim());
                endPort   = int.Parse(portRange.Split('-')[1].Trim());

                for (int port = startPort; port < endPort; port++)
                {
                    Scanner scanner = new Scanner(host, port);
                    Thread  thread  = new Thread(new ThreadStart(scanner.Scan));
                    thread.Name         = port.ToString();
                    thread.IsBackground = true;
                    thread.Start();

                    runningThreadCount++;
                    Thread.Sleep(10);

                    //循环,直到某个线程工作完毕才启动另一新线程,也可以叫做推拉窗技术
                    while (runningThreadCount >= maxThread)
                    {
                        ;
                    }
                }
                //空循环,直到所有端口扫描完毕
                while (scannedCount + 1 <= (endPort - startPort))
                {
                    Thread.Sleep(10);
                    Console.WriteLine();
                }


                //输出结果
                aTextBox.Clear();
                aTextBox.Text = "Scan for host:" + host + " has been completed, \r\n total " + (endPort - startPort) + " ports scanned, \n opened ports:" + openedPorts.Count;
                foreach (int port in openedPorts)
                {
                    aTextBox.Text = aTextBox.Text + "\r\nport:" + port.ToString().PadLeft(6) + " is open";
                }
                foreach (int port in closedPorts)
                {
                    aTextBox.Text = aTextBox.Text + "\r\nport:" + port.ToString().PadLeft(6) + " is closed";
                }
                aButton.Enabled = true;
            }
Example #21
0
 private void buttonSend_Click(object sender, System.EventArgs e)
 {
     try
     {
         broadcastData(txtDataTx.Text, true);
         txtDataTx.Clear();
     }
     catch (SocketException se)
     {
         MessageBox.Show(se.Message);
     }
 }
Example #22
0
 private void Check_btn_click(object sender, EventArgs e)
 {
     result_tb.Clear();
     for (int i = 0; i < 33; i++)
     {
         perseptron[i].SetX(template);
         if (perseptron[i].Y == 1)
         {
             result_tb.Text += perseptron[i].letter;
         }
     }
 }
Example #23
0
        private void BTexe_Click(object sender, System.EventArgs e)
        {
            TBDBlog.Clear();
            WARKING_SendMsgBox();
            if (WARKING == true)
            {
                return;
            }
            //----入力エラーチェック
            if (TBtarget.Text.Length == 0)
            {
                MessageBox.Show("ファイルが選択されてません", "エラー",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (TBsyutu.Text.Length == 0)
            {
                MessageBox.Show("出力フォルダが選択されてません", "エラー",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (false == Directory.Exists(TBsyutu.Text))
            {
                MessageBox.Show("出力フォルダが存在しません", "エラー",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (TBCBN.Text.Length == 0)
            {
                MessageBox.Show("連番ファイルの基本名が不明です", "エラー",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (COMBkaku.Text.Length == 0)
            {
                MessageBox.Show("抽出拡張子が選択されてません", "エラー",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            //スレッドかけないとGUIがブロックする

            SelectKakutyousi = COMBkaku.SelectedItem.ToString(); // 別スレッドでGUI要素は呼べない
#if DEBUG
            EXECUT();
#else
            Thread THEXECUT = new Thread(new ThreadStart(EXECUT));
            THEXECUT.Start();
#endif
            //THEXECUT.Join();
            //処理中止ボタン
            //処理中止するときは途中から開始できるようKITENなどを保存しとく
            //THEXECUT.Abort();
        }
        /// <summary>
        /// Add logging event to configured control
        /// </summary>
        /// <param name="loggingEvent">The event to log</param>
        private void UpdateControl(LoggingEvent loggingEvent)
        {
            // There may be performance issues if the buffer gets too long
            // So periodically clear the buffer
            if (_textBox.TextLength > _maxTextLength)
            {
                _textBox.Clear();
                _textBox.AppendText(string.Format("(earlier messages cleared because log length exceeded maximum of {0})\n\n", _maxTextLength));
            }

            _textBox.AppendText(RenderLoggingEvent(loggingEvent));
        }
Example #25
0
        protected override void InformaLimpaDados(bool bInformar)
        {
            base.InformaLimpaDados(bInformar);

            if (bInformar)
            {
                edtEmail.Text      = Campos[2].ToString();
                edtIdentidade.Text = Campos[3].ToString();
                if (Campos[4].ToString() == "M")
                {
                    rbMasculino.Checked = true;
                    rbFeminino.Checked  = false;
                }
                else
                {
                    rbMasculino.Checked = false;
                    rbFeminino.Checked  = true;
                }
                edtTelefone.Text     = Campos[5].ToString();
                edtDtNascimento.Text = RotinasGlobais.Rotinas.FormataDataStr(
                    Campos[6].ToString(), "dd/MM/yyyy");
                edtCodEndereco.Text  = Campos[7].ToString();
                edtLogradouro.Text   = Campos[8].ToString();
                edtBairro.Text       = Campos[9].ToString();
                edtCEP.Text          = Campos[10].ToString();
                edtCidade.Text       = Campos[11].ToString();
                edtEstado.Text       = Campos[12].ToString();
                edtCodPais.Text      = Campos[13].ToString();
                edtPais.Text         = Campos[14].ToString();
                edtCodProfissao.Text = Campos[15].ToString();
                edtProfissao.Text    = Campos[16].ToString();
            }
            else
            {
                edtEmail.Clear();
                edtIdentidade.Clear();
                rbMasculino.Checked = false;
                rbFeminino.Checked  = false;
                edtTelefone.Clear();
                edtDtNascimento.Value = DateTime.Now;
                edtCodEndereco.Clear();
                edtLogradouro.Clear();
                edtBairro.Clear();
                edtCEP.Clear();
                edtCidade.Clear();
                edtEstado.Clear();
                edtCodPais.Clear();
                edtPais.Clear();
                edtCodProfissao.Clear();
                edtProfissao.Clear();
            }
        }
Example #26
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (txt_NombreImagen.Text.Trim() == "")
            {
                MessageBox.Show("Escribe el nombre de la imagen", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                errorProvider1.SetError(txt_NombreImagen, "No puedes dejar el campo vacio");
            }
            else
            {
                if (fotografiaHecha)
                {
                    // Recorto la imagen conforme lo mostrado (Size del pctbox_webcam)
                    Rectangle formaRecorte = new Rectangle(0, 0, 300, 300);
                    Bitmap    imagenOrigen = (Bitmap)pctbox_imagen.Image;
                    Bitmap    imagen       = imagenOrigen.Clone(formaRecorte, imagenOrigen.PixelFormat);

                    // Y la guardo
                    try
                    {
                        string ruta = @"C:\Shajobe\Imagenes";

                        if (System.IO.Directory.Exists(ruta))
                        {
                            //String ruta = txt_NombreImagen.Text.Trim();
                            if (!ruta.Substring(ruta.Length - 1).Equals("\\"))
                            {
                                ruta += "\\";
                            }
                            ruta = ruta + txt_NombreImagen.Text + ".jpg";
                            imagen.Save(ruta);
                            MessageBox.Show("Fotografía almacenada", "Información",
                                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txt_NombreImagen.Clear();
                        }
                        else
                        {
                            MessageBox.Show("Carpeta no existe se va a generar el directorio presione aceptar y vuelva a intentarlo", "La carpeta no existe.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            CrearDirectorioImagenes();
                        }
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(exc.Message, "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("Para guardar la fotografía, use en primer lugar el botón de Captura", "Información",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #27
0
        private void bAddLoc_Click(object sender, System.EventArgs e)
        {
            TreeNode parent = tCat.SelectedNode;

            if (parent.Tag == null)
            {
                return;
            }

            int x   = 0;
            int y   = 0;
            int z   = 0;
            int map = 0;

            Location loc = new Location();

            loc.Name = txLoc.Text;

            if (rClient.Checked)
            {
                Ultima.Client.Calibrate();
                Ultima.Client.FindLocation(ref x, ref y, ref z, ref map);
            }
            else if (rMap.Checked)
            {
                map = (int)m_Map.Map;
                x   = m_Map.Center.X;
                y   = m_Map.Center.Y;
                z   = m_Map.GetMapHeight();
            }

            loc.X   = (short)x;
            loc.Y   = (short)y;
            loc.Z   = ( sbyte)z;
            loc.Map = map;

            TreeNode node = new TreeNode(loc.Name);

            node.Tag = loc;
            tLoc.Nodes.Add(node);
            tLoc.SelectedNode = node;

            // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
            (parent.Tag as List <object>).Add(loc);
            // Issue 10 - End

            txLoc.Clear();
            txLoc.Focus();

            m_Changed = true;
            EnableButtons();
        }
Example #28
0
            private void addCustomPathButton_Click(object sender, EventArgs e)
            {
                string path = customPathTextBox.Text;

                if (!Directory.Exists(path))
                {
                    MessageBox.Show(this, "The directory at the specified path doesn't exist.", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                AddPlace(new CustomFileDialogPlace(path));
                customPathTextBox.Clear();
            }
Example #29
0
 private void Form1_Load(object sender, System.EventArgs e)
 {
     txtLookfor.Clear();
     txtSelected.Clear();
     try
     {
         OpenAPITextFile(@"W:\_projects\oligo.gui_testing\book_resources\Chapter03\WIN32API.TXT");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #30
0
 protected override void InformaLimpaDados(bool bInformar)
 {
     base.InformaLimpaDados(bInformar);
     if (bInformar)
     {
         edtEdicao.Text          = Campos[2].ToString();
         edtAnoPubli.Text        = Campos[3].ToString();
         edtVolume.Text          = Campos[4].ToString();
         edtCodEditora.Text      = Campos[5].ToString();
         edtEditora.Text         = Campos[6].ToString();
         cmbIdioma.SelectedIndex = slIdiomas.IndexOf(Campos[7].ToString());
         edtNPaginas.Text        = Campos[9].ToString();
         edtPreco.Text           = RotinasGlobais.Rotinas.
                                   VirgulaParaPonto(Campos[10].ToString(), true);
         edtQtdEstoque.Text = Campos[11].ToString();
         RotinasGlobais.Rotinas.AdicionaValoresLista(ConsLista, ConsultasSQL.
                                                     ConsSQL.LivroAss('S', edtCodigo.Text, ""), lstAssuntos, slAssuntos);
         RotinasGlobais.Rotinas.AdicionaValoresLista(ConsLista, ConsultasSQL.
                                                     ConsSQL.LivroAut('S', edtCodigo.Text, ""), lstAutores, slAutores);
     }
     else
     {
         edtEdicao.Value  = 1;
         edtAnoPubli.Text = DateTime.Now.ToString("yyyy");
         edtVolume.Value  = 1;
         edtCodEditora.Clear();
         edtEditora.Clear();
         edtNPaginas.Value   = 1;
         edtPreco.Text       = "0,00";
         edtQtdEstoque.Value = 1;
         edtCodAssunto.Clear();
         lstAssuntos.Items.Clear();
         edtCodAutor.Clear();
         lstAutores.Items.Clear();
         slAssuntos.Clear();
         slAutores.Clear();
     }
 }
Example #31
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            DataSet   ds              = EditorApp.Instance.RuleSetData;
            DataRow   eraRow          = ((DataRowView)this.currencyManager.Current).Row;
            DataTable researcherTable = ds.Tables["Researcher"];
            DataRow   row             = researcherTable.NewRow();

            row["EraID"]          = eraRow["EraID"];
            row["ResearcherName"] = this.txtResearcherName.Text;
            researcherTable.Rows.Add(row);
            row.SetParentRow(eraRow);
            txtResearcherName.Clear();
            UpdateResearchers();
        }
 private void bttnReset_Click(object sender, System.EventArgs e)
 {
     //Clear All TextFields
     txtFirstName.Clear();
     txtMiddleName.Clear();
     txtLastName.Clear();
     txtStreetAddress.Clear();
     txtCity.Clear();
     txtProvince.Clear();
     txtZipCode.Clear();
     txtContactNo.Clear();
     txtEmailAdd.Clear();
     txtUserID.Clear();
     txtPassword.Clear();
 }
Example #33
0
        private void cmdSend_Click(object sender, System.EventArgs e)
        {
            try
            {
                string objData = txtDataTx.Text;
                byte[] byData  = Encoding.ASCII.GetBytes(objData + Environment.NewLine);
                m_socClient.Send(byData);

                txtDataTx.Clear();
            }
            catch (SocketException se)
            {
                MessageBox.Show(se.Message);
            }
        }
Example #34
0
 //decimal type validation
 public bool IsDecimal(TextBox textbox, string name)
 {
     decimal number = 0;
     if (decimal.TryParse(textbox.Text, out number))
     {
         return true;
     }
     else
     {
         MessageBox.Show(name + " must be a decimal.", "Entry Error");
         textbox.Clear();
         textbox.Focus();
         return false;
     }
 }
 private void cmbRx_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbRx.SelectedIndex > -1 && !String.IsNullOrEmpty(this.cmbRx.Text))
     {
         txtRxDesc.Clear();
         string strRx = this.cmbRx.Text.Trim();
         foreach (RxItem oItem in this.ReferenceFormRxPackageItem.ReferenceRxItemCollection)
         {
             if (strRx.Equals(oItem.RxId))
             {
                 txtRxDesc.Text = oItem.Description;
             }
         }
     }
 }
Example #36
0
        private void cbServer_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string sLogin = string.Empty;

            if (cbServer.SelectedItem != null)
            {
                sLogin = ((SqlLogin)cbServer.SelectedItem).Login;
            }

            if (sLogin == string.Empty)
            {
                rbAuthNT.Checked = true;
                txtLogin.Clear();
                txtPassword.Clear();
                rbAuthNT.Focus();
            }
            else
            {
                rbAuthSQL.Checked = true;
                txtLogin.Text     = sLogin;
                txtPassword.Clear();
                rbAuthSQL.Focus();
            }
        }
Example #37
0
 private void checkBox_File_size_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox_File_size.Checked)
     {
         textBox_File_size.Visible = true;
         label_File_size.Visible   = true;
     }
     else
     {
         fileSize = 0;
         textBox_File_size.Clear();
         textBox_File_size.Visible = false;
         label_File_size.Visible   = false;
     }
 }
Example #38
0
        private void btnDischarge_Click(object sender, System.EventArgs e)
        {
            Admissions adminssions = new Admissions();

            if (txtPatientID.Text.Length > 0)
            {
                adminssions.SetPatientDischarge(txtPatientID.Text);
                MessageBox.Show("Patient has successfuly been discharged.");
                txtPatientID.Clear();
            }
            else
            {
                MessageBox.Show("Invalid Patient ID.");
            }
        }
 private void bttnReset_Click(object sender, System.EventArgs e)
 {
     txtFirstName.Clear();
     txtMiddleName.Clear();
     txtLastName.Clear();
     txtStreetAddress.Clear();
     txtCity.Clear();
     txtProvince.Clear();
     txtZipCode.Clear();
     txtContactNo.Clear();
     txtEmailAdd.Clear();
     txtCourseName.Clear();
     txtLevelName.Clear();
     txtSchoolYear.Clear();
 }
        private void menuItemNew_Click(object sender, System.EventArgs e)
        {
            if (needToSave == true)
            {
                DialogResult result = MessageBox.Show("文本内容已经改变,需要保存吗?", "保存文件", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (result)
                {
                case DialogResult.Yes:
                {
                    menuItemSave_Click(sender, e);
                    textBoxEdit.Clear();
                    this.Text  = "文本编辑--新建文本";
                    needToSave = false;
                    break;
                }

                case DialogResult.No:
                {
                    textBoxEdit.Clear();
                    this.Text  = "文本编辑--新建文本";
                    needToSave = false;
                    break;
                }

                case DialogResult.Cancel:
                {
                    break;
                }
                }
            }
            else
            {
                textBoxEdit.Clear();
                this.Text = "文本编辑新建文本";
            }
        }
Example #41
0
        private void btnDischarge_Click(object sender, System.EventArgs e)
        {
            Admissions admin = new Admissions();

            if (txtPatientID.Text.Length > 0)
            {
                admin.SetPatientDischarge(txtPatientID.Text);
                MessageBox.Show("Patient discharge date recorded and bed has been set as unoccupied.");
                txtPatientID.Clear();
            }
            else
            {
                MessageBox.Show("Patient ID entered is not valid.");
            }
        }
Example #42
0
 //Data type validation for INT
 public bool IsInt(TextBox textbox, string name)
 {
     int number = 0;
     if (int.TryParse(textbox.Text, out number))
     {
         return true;
     }
     else
     {
         MessageBox.Show(name + " must be an integer.", "Entry Error");
         textbox.Clear();
         textbox.Focus();
         return false;
     }
 }
Example #43
0
 private void OnSend(object sender, System.EventArgs e)
 {
     try
     {
         // Sends a message to the group
         byte[] data = encoding.GetBytes(name + ": " + textMessage.Text);
         client.Send(data, data.Length, remoteEP);
         textMessage.Clear();
         textMessage.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error MulticastChat",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #44
0
        public decimal tbToDecimal(TextBox tb, string errMessage = "")
        {
            decimal num = 0m;
            if (tb.Text.Length == 0) return num;

            try
            {
                num = Convert.ToDecimal(tb.Text);
                tb.Clear();
            }
            catch (FormatException e)
            {
                errMessage = (errMessage.Length > 0 ? errMessage : e.Message);
                MessageBox.Show(errMessage);
            }

            return num;
        }
Example #45
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="str"></param>
        /// <param name="errMessage"></param>
        /// <param name="defaultIfBlank"></param>
        /// <returns></returns>
        public int tbToInt(TextBox tb, string errMessage = "", bool OneIfBlank = false)
        {
            int num = 0;
            if (tb.Text == "")
                return 1;

            try
            {
                num = Convert.ToInt32(tb.Text);
                tb.Clear();
            }
            catch (FormatException e)
            {
                errMessage = (errMessage.Length > 0 ? errMessage : e.Message);
                MessageBox.Show(errMessage);
            }

            return num;
        }
Example #46
0
 //Poziva se pritiskom na tipku "/".Metoda postavlja zastavicu za zbrajanje, pretvara vrijednosti iz navedenog textboxa, iz stringa u double broj
 //te ga sprema u globalnu varijablu broj1,kopira vrijednosti iz većeg textboxa u manji, te mu dodaje znak dijeljenja, te čisti veći textbox. 
 public void dij(TextBox t, TextBox c)
 {
     setDijeljenje();
     broj1 = double.Parse(t.Text);
     c.Text = t.Text + " / ";
     t.Clear();
     decZarez = false;
 }
Example #47
0
 //Poziva se pritiskom na tipku "+".Metoda postavlja zastavicu za zbrajanje, pretvara vrijednosti iz navedenog textboxa, iz stringa u double broj
 //te ga sprema u globalnu varijablu broj1,kopira vrijednosti iz većeg textboxa u manji, te mu dodaje znak zbrajanja, te čisti veći textbox. 
 public void zbr(TextBox t, TextBox c)
 {
     setZbrajanje();
     broj1 = double.Parse(t.Text);
     c.Text = t.Text + " + ";
     t.Clear();
     decZarez = false;
 }
Example #48
0
 //Upisuje određeni broj kao string u navedeni textbox.Te provjerava da li je jednako bilo pritisnuto, ako je, onda briše oba texboxa,
 //te upisuje broj na prazno
 public void upisBroja(TextBox t, TextBox c, string number, bool zastavica)
 {
     if (zastavica == true)
     {
         t.Clear();
         c.Clear();
         t.Text = t.Text + number;
         zastavica = false;
     }
     else
     {
         t.Text = t.Text + number;
     }
     jednakoPritisnuto = false;
 }
 /// <summary>
 /// 将数据放入TextBox里进行展示
 /// </summary>
 /// <param name="collectionName"></param>
 /// <param name="txtData"></param>
 /// <param name="dataList"></param>
 public static void FillDataToTextBox(TextBox txtData, List<BsonDocument> dataList)
 {
     txtData.Clear();
     if (_hasBSonBinary)
     {
         txtData.Text = "二进制数据块";
     }
     else
     {
         int Count = 1;
         StringBuilder sb = new StringBuilder();
         foreach (BsonDocument BsonDoc in dataList)
         {
             sb.AppendLine("/* " + (SkipCnt + Count).ToString() + " */");
             sb.AppendLine("{");
             foreach (String itemName in BsonDoc.Names)
             {
                 BsonValue value = BsonDoc.GetValue(itemName);
                 sb.Append(GetBsonElementText(itemName, value, 0));
             }
             sb.Append("}");
             sb.AppendLine("");
             sb.AppendLine("");
             Count++;
         }
         txtData.Text = sb.ToString();
     }
 }
Example #50
0
		public void ModifiedTest ()
		{
			TextBox t = new TextBox ();
			Assert.AreEqual (false, t.Modified, "modified-1");

			t.Modified = true;
			Assert.AreEqual (true, t.Modified, "modified-2");

			t.Modified = false;
			Assert.AreEqual (false, t.Modified, "modified-3");

			// Changes in Text property don't change Modified,
			// as opposed what the .net docs say
			t.ModifiedChanged += new EventHandler (TextBox_ModifiedChanged);

			modified_changed_fired = false;
			t.Text = "TEXT";
			Assert.AreEqual (false, t.Modified, "modified-4");
			Assert.AreEqual (false, modified_changed_fired, "modified-4-1");

			t.Modified = true;
			modified_changed_fired = false;
			t.Text = "hello";
			Assert.AreEqual (true, t.Modified, "modified-5");
			Assert.AreEqual (false, modified_changed_fired, "modified-5-1");

			t.Modified = false;
			modified_changed_fired = false;
			t.Text = "hello mono";
			Assert.AreEqual (false, t.Modified, "modified-6");
			Assert.AreEqual (false, modified_changed_fired, "modified-6-1");

			// The methods changing the text value, however,
			// do change Modified
			t.Modified = true;
			modified_changed_fired = false;
			t.AppendText ("a");
			Assert.AreEqual (false, t.Modified, "modified-7");
			Assert.AreEqual (true, modified_changed_fired, "modified-7-1");

			t.Modified = true;
			modified_changed_fired = false;
			t.Clear ();
			Assert.AreEqual (false, t.Modified, "modified-8");
			Assert.AreEqual (true, modified_changed_fired, "modified-8-1");

			t.Text = "a message";
			t.SelectAll ();
			t.Modified = false;
			t.Cut ();
			Assert.AreEqual (true, t.Modified, "modified-9");

			t.Modified = false;
			t.Paste ();
			Assert.AreEqual (true, t.Modified, "modified-10");

			t.Modified = false;
			t.Undo ();
			Assert.AreEqual (true, t.Modified, "modified-11");
		}
Example #51
0
File: temp.cs Project: Khelek/XMPP
        private void createTabPage(string tabName, string insideText = null, string key = "")
        {
            TabPage p = new TabPage(tabName);
            p.Name = key;
            TextBox dialog = new TextBox();
            dialog.Location = tabsDialog.Location;
            dialog.Size = new System.Drawing.Size(450, 170);
            dialog.Multiline = true;
            dialog.ScrollBars = ScrollBars.Vertical;
            dialog.ReadOnly = true;
            dialog.BackColor = Color.White;
            if (insideText != null)
            {
                dialog.AppendText(insideText);
            }

            TextBox textBoxSend = new TextBox();
            textBoxSend.Location = new Point(dialog.Location.X, dialog.Location.Y + dialog.Height);
            textBoxSend.Size = new System.Drawing.Size(240, 45);
            textBoxSend.Multiline = true;

            Button send = new Button();
            send.Text = "Послать";
            send.Location = new Point(dialog.Location.X + dialog.Width - 80, dialog.Location.Y + dialog.Height + 10);
            send.Click += delegate(object s, EventArgs a)
            {
                SendTextMessage(tabName, p.Name, dialog, textBoxSend.Text);
                textBoxSend.Clear();
            };

            CheckBox enter = new CheckBox();
            enter.Text = "Send if Enter";
            enter.Location = new Point(textBoxSend.Location.X + textBoxSend.Width + 10, dialog.Location.Y + dialog.Height + 5);
            enter.Checked = true;

            textBoxSend.KeyDown += delegate(object o, KeyEventArgs k)
            {
                if (k.KeyCode == Keys.Enter && enter.Checked)
                {
                    SendTextMessage(tabName, p.Name, dialog, textBoxSend.Text);
                    textBoxSend.Clear();
                }
            };

            p.Controls.AddRange(new Control[] { dialog, textBoxSend, send, enter });
            tabsDialog.TabPages.Add(p);
        }
Example #52
0
 private void TextBoxClear2(TextBox Object)
 {
     Object.Clear();
 }
        private bool TryRegHotkey(TextBox tb)
        {
            var hotkey = HotKeys.Str2HotKey(tb.Text);
            if (hotkey == null)
            {
                MessageBox.Show(string.Format(I18N.GetString("Cannot parse hotkey: {0}"), tb.Text));
                tb.Clear();
                return false;
            }

            PrepareForHotkey(tb, out _callBack, out _lb);

            UnregPrevHotkey(_callBack);

            // try to register keys
            // if already registered by other progs
            // notify to change

            // use the corresponding label color to indicate
            // reg result.
            // Green: not occupied by others and operation succeed
            // Yellow: already registered by other program and need action: disable by clear the content
            //         or change to another one
            // Transparent without color: first run or empty config

            bool regResult = HotKeys.Regist(hotkey, _callBack);
            _lb.BackColor = regResult ? Color.Green : Color.Yellow;
            return regResult;
        }
Example #54
0
 //poziva se unutar metode izracunaj, koja se pozove pritiskom na tipku "=", te metoda čisti oba texboxa, te u veći ispisuje rezultat, koji se 
 //prenese u varijablu br
 public void ispisRezultata(TextBox c, TextBox t, double br)
 {
     c.Clear();
     t.Clear();
     t.Text = br.ToString();
 }
Example #55
0
 private void pushOverflowError( TextBox box )
 {
     box.Clear();
     box.Text = "Overflow";
     box.SelectAll();
 }
Example #56
0
 //Poziva se pritiskom na tipku "*".Metoda postavlja zastavicu za zbrajanje, pretvara vrijednosti iz navedenog textboxa, iz stringa u double broj
 //te ga sprema u globalnu varijablu broj1,kopira vrijednosti iz većeg textboxa u manji, te mu dodaje znak mnozenja, te čisti veći textbox. 
 public void mnoz(TextBox t, TextBox c)
 {
     setMnozenje();
     broj1 = double.Parse(t.Text);
     c.Text = t.Text + " * ";
     t.Clear();
     decZarez = false;
 }
Example #57
0
        public void Entrar(Form f, TextBox user, TextBox pass)
        {
            try{

            sql = new SqlConnection(CadCon.Servidor());
            sql.Open();

            cmd = new SqlCommand("Entrar", sql);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@usuario", user.Text);
            cmd.Parameters.AddWithValue("@pass", pass.Text);
             int operacion = cmd.ExecuteNonQuery();
             DataTable d = new DataTable();
             SqlDataAdapter data = new SqlDataAdapter(cmd);
                data.Fill(d);

               if (d.Rows.Count >0)
                {
                    LoadThread lt = new LoadThread();
                   lt.Show();
                   f.Hide();
                }
                else {
                    MessageBox.Show("Nombre de usuario o contraseña incorrectos\n", "",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    user.Focus();
                    pass.Clear();
                  }
                cmd.Dispose();
                sql.Close();
              }
              catch (SqlException s) { MessageBox.Show(s.Message); }
        }
Example #58
0
 private void ClearCellWithInvalidValue(TextBox cell)
 {
     cell.TextChanged -= new EventHandler(this.TextBox_TextChanged);         
     cell.Clear();
     cell.TextChanged += new EventHandler(this.TextBox_TextChanged);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="txtData"></param>
        /// <param name="dataList"></param>
        public static void FillJSONDataToTextBox(TextBox txtData, List<BsonDocument> dataList, int SkipCnt)
        {
            txtData.Clear();
            int Count = 1;
            StringBuilder sb = new StringBuilder();
            foreach (BsonDocument BsonDoc in dataList)
            {
                sb.AppendLine("/* " + (SkipCnt + Count).ToString() + " */");

                sb.AppendLine(BsonDoc.ToJson(SystemManager.JsonWriterSettings));
                Count++;
            }
            txtData.Text = sb.ToString();
        }
Example #60
0
 //Poziva se pritiskom na tipku "-".Metoda postavlja zastavicu za zbrajanje, pretvara vrijednosti iz navedenog textboxa, iz stringa u double broj
 //te ga sprema u globalnu varijablu broj1,kopira vrijednosti iz većeg textboxa u manji, te mu dodaje znak oduzimanja, te čisti veći textbox. 
 public void oduz(TextBox t, TextBox c)
 {
     setOduzimanje();
     broj1 = double.Parse(t.Text);
     c.Text = t.Text + " - ";
     t.Clear();
     decZarez = false;
 }