示例#1
0
        //===================================================================================================


        //Este método tem a função de Adicionar, Alterar, Remover e Consultar uma ListBox====================
        public void ManipListas(ListBox Lista, TextBox Sabor, MaskedTextBox Preco, int func, string entrada = "")
        {
            String[] Consulta = new string[2];
            if (func == 1)
            {
                if (Sabor.Text != "" && Preco.Text != "") //Adicionar Item
                {
                    Lista.Items.Add(Sabor.Text + "-" + Preco.Text);
                    Preco.Clear();
                    Sabor.Clear();
                }
            }
            else if (func == 2) //Alterar Item
            {
                if (Lista.SelectedIndex != -1)
                {
                    Lista.Items.RemoveAt(Lista.SelectedIndex);
                    Lista.Items.Add(Sabor.Text + "-" + Preco.Text);
                    Preco.Clear();
                    Sabor.Clear();
                }
            }
            else if (func == 3) //Remover Item
            {
                if (Lista.SelectedIndex != -1)
                {
                    Lista.Items.RemoveAt(Lista.SelectedIndex);
                    Lista.SelectedIndex = -1;
                    Preco.Clear();
                    Sabor.Clear();
                }
            }

            else if (func == 4) //Consultar Lista
            {
                if (Lista.SelectedIndex != -1)
                {
                    Preco.Clear();
                    Sabor.Clear();
                    try
                    {
                        Consulta   = (Lista.SelectedItem.ToString()).Split('-');
                        Sabor.Text = Consulta[0];
                        Preco.Text = Consulta[1];
                    }
                    catch (Exception erro)
                    {
                        Sabor.Text = "Nenhum";
                        Preco.Text = "Nenhum";
                    }
                }
            }
        }
示例#2
0
 private void BtncustomerEdit_Click(object sender, EventArgs e)
 {
     CCC = new CustomerConnectComponent();
     CCC.musteriDuzenleControl((int)datagridview1.CurrentRow.Cells["CustomerID"].Value, txtcustomerName, txtCustomerSurname, txtcustomerTelephone, txtcustomerOccupotion, cmbcustomerReference, txtcustomerAccount, rctxtcustomerAddress, rctxtcustomerDetails);
     CCC.musteriListe(datagridview1);
     CCC.cmboboxReferansDoldur(cmbcustomerReference);
     foreach (var item in this.groupBox3.Controls)
     {
         if (item is TextBox)
         {
             TextBox tx = (TextBox)item;
             tx.Clear();
         }
         else if (item is NumericUpDown)
         {
             NumericUpDown num = (NumericUpDown)item;
             num.Value = 0;
         }
         else if (item is RichTextBox)
         {
             RichTextBox rx = (RichTextBox)item;
             rx.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox ms = (MaskedTextBox)item;
             ms.Clear();
         }
     }
 }
        public void ClearAll(Control ctrl)
        {
            foreach (Control item in ctrl.Controls)
            {
                if (item is TextBox)
                {
                    TextBox a = (TextBox)item;
                    a.Clear();
                }

                else if (item is MaskedTextBox)
                {
                    MaskedTextBox m = (MaskedTextBox)item;
                    m.Clear();
                }


                else
                {
                    if (item.Controls.Count > 0)
                    {
                        ClearAll(item);

                        this.lbl_modifyerror.Hide();
                        this.lbl_recordinserted.Hide();
                        this.lbl_updatedrecord.Hide();
                        this.lbl_deletedrecord.Hide();
                    }
                }
            }
        }
 public static void Temizle(Control.ControlCollection koleksiyon)
 {
     foreach (Control item in koleksiyon)
     {
         if (item is TextBox)
         {
             TextBox txt = (TextBox)item;
             txt.Clear();
         }
         else if (item is ComboBox)
         {
             ComboBox cb = (ComboBox)item;
             //cb.SelectedIndex = 0;
             cb.SelectedItem = null;
         }
         else if (item is RichTextBox)
         {
             RichTextBox rTxt = (RichTextBox)item;
             rTxt.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mTxt = (MaskedTextBox)item;
             mTxt.Clear();
         }
         else if (item is DateTimePicker)
         {
             DateTimePicker dtPicker = (DateTimePicker)item;
             dtPicker.Value = DateTime.Now;
         }
     }
 }
示例#5
0
 private void Temizle()
 {
     foreach (Control item in this.Controls)
     {
         if (item is TextBox)
         {
             TextBox tbox = (TextBox)item;
             tbox.Clear();
         }
         else if (item is DateTimePicker)
         {
             DateTimePicker dtime = (DateTimePicker)item;
             dtime.ResetText();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mtbox = (MaskedTextBox)item;
             mtbox.Clear();
         }
         else if (item is ComboBox)
         {
             ComboBox cmbox = (ComboBox)item;
             cmbox.Text = "";
         }
     }
 }
        public void ClearAll(Control ctrl)
        {
            foreach (Control item in ctrl.Controls)
            {
                if (item is TextBox)
                {
                    TextBox a = (TextBox)item;
                    a.Clear();
                }


                else if (item is MaskedTextBox)
                {
                    MaskedTextBox d = (MaskedTextBox)item;
                    d.Clear();
                }

                else if (item is ComboBox)
                {
                    ComboBox c = (ComboBox)item;
                    c.SelectedIndex = -1;
                }
                else
                {
                    if (item.Controls.Count > 0)
                    {
                        ClearAll(item);
                        this.lbl_modifyerror.Hide();
                        this.lbl_insertedrecord.Hide();
                    }
                }
            }
        }
示例#7
0
文件: SYSCON.cs 项目: i1920929/syscon
 public static void limpiar(GroupBox frm)
 {
     foreach (Control ctrl in frm.Controls)
     {
         if (ctrl is TextBox)
         {
             TextBox text = ctrl as TextBox;
             text.Clear();
         }
         if (ctrl is ComboBox)
         {
             ComboBox cmb = ctrl as ComboBox;
             cmb.SelectedIndex = -1;
         }
         if (ctrl is MaskedTextBox)
         {
             MaskedTextBox mst = ctrl as MaskedTextBox;
             mst.Clear();
         }
         if (ctrl is NumericUpDown)
         {
             NumericUpDown nud = ctrl as NumericUpDown;
             nud.Value = 0;
         }
     }
 }
示例#8
0
 public void FormuTemizle()
 {
     foreach (Control item in this.Controls)
     {
         if (item is TextBox)
         {
             TextBox txt = item as TextBox;
             txt.Clear();
         }
         if (item is ComboBox)
         {
             ComboBox cb = item as ComboBox;
             cb.SelectedIndex = 0;
         }
         if (item is MaskedTextBox)
         {
             MaskedTextBox mtxt = item as MaskedTextBox;
             mtxt.Clear();
         }
         if (item is NumericUpDown)
         {
             NumericUpDown nud = item as NumericUpDown;
             nud.Value = 0;
         }
     }
 }
 void Temizle()
 {
     foreach (TabPage s in this.tabControl1.TabPages)
     {
         dtpOpTarih.Value = DateTime.Now;
         foreach (Control item in s.Controls)
         {
             if (item is TextBox)
             {
                 TextBox txt = item as TextBox;
                 txt.Clear();
             }
             if (item is MaskedTextBox)
             {
                 MaskedTextBox txt = item as MaskedTextBox;
                 txt.Clear();
             }
             if (item is ComboBox)
             {
                 ComboBox cbx = item as ComboBox;
                 cbx.Text = "";
             }
         }
     }
     _secimId       = -1;
     _edit          = false;
     btnKaydet.Text = "Kaydet";
 }
示例#10
0
 public void ClearAll(Control ctrl)
 {
     foreach (Control item in ctrl.Controls)
     {
         if (item is TextBox)
         {
             TextBox a = (TextBox)item;
             a.Clear();
         }
         else if (item is ComboBox)
         {
             ComboBox c = (ComboBox)item;
             c.SelectedIndex = -1;
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox d = (MaskedTextBox)item;
             d.Clear();
         }
         else
         {
             if (item.Controls.Count > 0)
             {
                 ClearAll(item);
                 txt_transactionid.Enabled = true;
             }
         }
     }
 }
 public void ClearAll(Control ctrl)
 {
     foreach (Control item in ctrl.Controls)
     {
         if (item is TextBox)
         {
             TextBox a = (TextBox)item;
             a.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox m = (MaskedTextBox)item;
             m.Clear();
         }
         else if (item is ComboBox)
         {
             ComboBox c = (ComboBox)item;
             c.SelectedIndex = -1;
         }
         else
         {
             if (item.Controls.Count > 0)
             {
                 ClearAll(item);
                 this.lbl_modifyerror.Hide();
                 this.lbl_insertedrecord.Hide();
                 this.lbl_updatedrecord.Hide();
                 this.lbl_deletedrecord.Hide();
                 txt_perproductprice.Text = (".00");
             }
         }
     }
 }
示例#12
0
文件: Funciones.cs 项目: edalca/SICI
 public static void Limpiar(Control control)
 {
     foreach (Control c in control.Controls)
     {
         if (c.GetType() == typeof(GroupBox) || c.GetType() == typeof(Panel))
         {
             Limpiar(c);
         }
         else
         if (c.GetType() == typeof(MetroTextBox))
         {
             MetroTextBox textBox = (MetroTextBox)c;
             textBox.Clear();
         }
         else
         if (c.GetType() == typeof(MetroComboBox))
         {
             MetroComboBox comboBox = (MetroComboBox)c;
             comboBox.Text = null;
         }
         else
         if (c.GetType() == typeof(MetroButton))
         {
             MetroButton button = c as MetroButton;
             button.ButtonID = 0;
         }
         else
         if (c.GetType() == typeof(MaskedTextBox))
         {
             MaskedTextBox maskedTextBox = c as MaskedTextBox;
             maskedTextBox.Clear();
         }
     }
 }
示例#13
0
 void Temizle1()
 {
     foreach (Control item in groupBox1.Controls)
     {
         if (item is TextBox)
         {
             TextBox txt = (TextBox)item;
             txt.Clear();
         }
         else if (item is DateTimePicker)
         {
             DateTimePicker dt = (DateTimePicker)item;
             dt.Value = DateTime.Now;
         }
         else if (item is RadioButton)
         {
             RadioButton rd = (RadioButton)item;
             rd.Checked = false;
         }
         else if (item is RichTextBox)
         {
             RichTextBox rc = (RichTextBox)item;
             rc.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mt = (MaskedTextBox)item;
             mt.Clear();
         }
     }
     foreach (Control item in groupBox2.Controls)
     {
         if (item is TextBox)
         {
             TextBox txt = (TextBox)item;
             txt.Clear();
         }
         else if (item is DateTimePicker)
         {
             DateTimePicker dt = (DateTimePicker)item;
             dt.Value = DateTime.Now;
         }
         else if (item is RadioButton)
         {
             RadioButton rd = (RadioButton)item;
             rd.Checked = false;
         }
         else if (item is RichTextBox)
         {
             RichTextBox rc = (RichTextBox)item;
             rc.Clear();
         }
         if (item is CheckBox)
         {
             CheckBox chc = (CheckBox)item;
             chc.Checked = false;
         }
     }
 }
示例#14
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (txtUser.Text != "")
            {
                if (!string.IsNullOrEmpty(txtPwd.Text.Replace(" ", "")))
                {
                    if (txtPwd.Text.Length > 3)
                    {
                        if (Sistema.VerificaLogin(txtUser.Text, txtPwd.Text))
                        {
                            string comando = "select id from tbl_usuarios where user = '******';";
                            Sistema.IDUsuarioLogado = int.Parse(Sistema.ConsultaSimples(comando));

                            Log.Login();

                            Hide();
                            ShowInTaskbar = false;

                            TInicial telaInicial = new TInicial();
                            telaInicial.ShowDialog();
                        }
                        else
                        {
                            txtPwd.Clear();
                            txtUser.Focus();
                        }
                    }
                    else
                    {
                        ListaErro.RetornaErro(27);
                        txtPwd.Clear();
                        txtPwd.Focus();
                    }
                }
                else
                {
                    ListaErro.RetornaErro(26);
                    txtPwd.Focus();
                }
            }
            else
            {
                ListaErro.RetornaErro(25);
                txtUser.Focus();
            }
        }
示例#15
0
 // Phone Number validator
 public static void IsValidPhone(MaskedTextBox txtInput, int size)
 {
     if (txtInput.TextLength != size)
     {
         // tirar depois
         MessageBox.Show("The Phone Number number must have *number digits.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtInput.Clear();
         txtInput.Focus();
     }
 }
示例#16
0
        private bool verificacao(MaskedTextBox actual)
        {
            double verify1;

            if ((actual.Text == string.Empty) || (!double.TryParse(actual.Text, out verify1)))
            {
                actual.Clear();
                verificacaoOk = false;
                return(true);
            }
            return(false);
        }
示例#17
0
 public void KontrolleriTemizle(params Control[] controller)
 {
     foreach (Control item in controller)
     {
         if (item is TextBox)
         {
             TextBox txtBox = (TextBox)item;
             txtBox.Clear();
         }
         else if (item is ListBox)
         {
             ListBox lstBox = (ListBox)item;
             lstBox.Items.Clear();
         }
         else if (item is PictureBox)
         {
             PictureBox picBox = (PictureBox)item;
             picBox.Image           = null;
             picBox.BackgroundImage = Image.FromFile("gri.jpg");
         }
         else if (item is DateTimePicker)
         {
             DateTimePicker dtp = (DateTimePicker)item;
             dtp.Value = DateTime.Now;
         }
         else if (item is ComboBox)
         {
             ComboBox cmBox = (ComboBox)item;
             cmBox.SelectedIndex = -1;
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mTxtBox = (MaskedTextBox)item;
             mTxtBox.Clear();
         }
         else if (item is NumericUpDown)
         {
             NumericUpDown num = (NumericUpDown)item;
             num.Value = num.Minimum;
         }
         else if (item is CheckBox)
         {
             CheckBox cBox = (CheckBox)item;
             cBox.Checked = false;
         }
         else if (item is Button)
         {
             Button btn = (Button)item;
             btn.Enabled = false;
         }
     }
 }
示例#18
0
        private void handleLogin(object sender, MouseEventArgs e)
        {
            string username = textUsername.Text;
            string password = textPassword.Text;

            if (_service.validateLogin(username, password))
            {
                textPassword.Clear();
                textUsername.Clear();
                loginPane.Hide();
                mainPane.Show();
            }
        }
示例#19
0
 private void Login()
 {
     if (pwBox.Text == "system11")
     {
         // The password is ok.
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         // The password is invalid.
         pwBox.Clear();
         MessageBox.Show("Inivalid password.");
         pwBox.Focus();
     }
 }
示例#20
0
 void temizle()
 {
     foreach (Control item in groupBox1.Controls)
     {
         if (item is TextBox)
         {
             TextBox txt = (TextBox)item;
             txt.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mq = (MaskedTextBox)item;
             mq.Clear();
         }
     }
 }
示例#21
0
        //Pass controls here to clear them all, add more as we go
        public static void ClearScreenControls(Control objContainer)
        {
            String strControlType = "";

            foreach (Control obj in objContainer.Controls)
            {
                strControlType = obj.GetType().ToString();

                switch (strControlType)
                {
                case "System.Windows.Forms.TextBox":
                    TextBox cntrlText = (TextBox)obj;
                    cntrlText.Clear();
                    break;

                case "System.Windows.Forms.CheckBox":
                    CheckBox cntrlCheck = (CheckBox)obj;
                    cntrlCheck.Checked = false;
                    break;

                case "System.Windows.Forms.ComboBox":
                    ComboBox cntrlCombo = (ComboBox)obj;
                    cntrlCombo.SelectedIndex = -1;
                    break;

                case "System.Windows.Forms.RadioButton":
                    RadioButton cntrlRad = (RadioButton)obj;
                    cntrlRad.Checked = false;
                    break;

                case "System.Windows.Forms.MaskedTextBox":
                    MaskedTextBox cntrlMasked = (MaskedTextBox)obj;
                    cntrlMasked.Clear();
                    break;

                //Call itself recursively if it finds a masked text box
                case "System.Windows.Forms.GroupBox":
                    GroupBox cntrlGroup = (GroupBox)obj;
                    ClearScreenControls(cntrlGroup);
                    break;

                default:
                    //Do nothing
                    break;
                }
            }
        }
示例#22
0
        /// <summary>
        /// Used to send the data to the DataGridView from the text boxes.
        /// </summary>
        public void PersonMethod(DataGridView dgvPerson, TextBox txtName, MaskedTextBox txtTelephoneNumber,
                                 TextBox txtPostalAddress, TextBox txtEmailAddress, MaskedTextBox txtBirthDate)
        {
            string Name;
            string TelephoneNumber;
            string PostalAddress;
            string EmailAddress;
            string BirthDate;

            if (txtName.Text != "" && txtTelephoneNumber.Text != "" && txtPostalAddress.Text != "" &&
                txtEmailAddress.Text != "" && txtBirthDate.Text != "")
            {
                try
                {
                    Name            = txtName.Text;
                    TelephoneNumber = txtTelephoneNumber.Text;
                    PostalAddress   = txtPostalAddress.Text;
                    EmailAddress    = txtEmailAddress.Text;
                    BirthDate       = txtBirthDate.Text;

                    string[] row = { Name, TelephoneNumber, PostalAddress, EmailAddress, BirthDate };
                    dgvPerson.Rows.Add(row);
                    dgvPerson.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                }
                catch (NullReferenceException)
                {
                    MessageBox.Show("Error: Empty Textbox", "Information Added Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (DeletedRowInaccessibleException)
                {
                    MessageBox.Show("Error: Delete Row Inaccessible", "Deleted Row Inaccessible", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (DuplicateNameException)
                {
                    MessageBox.Show("Error: Duplicate Name", "Duplicate Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                txtName.Clear();
                txtTelephoneNumber.Clear();
                txtPostalAddress.Clear();
                txtEmailAddress.Clear();
                txtBirthDate.Clear();
            }
            else
            {
                MessageBox.Show("Please enter data into all text boxes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#23
0
 public static void Limpiar(Control principal)
 {
     foreach (Control cont in principal.Controls)
     {
         if (cont is TextBox)
         {
             TextBox x = (TextBox)cont;
             x.Clear();
         }
         else
         if (cont is MaskedTextBox)
         {
             MaskedTextBox x = (MaskedTextBox)cont;
             x.Clear();
         }
     }
 }
示例#24
0
        private void btnUyeOl_Click(object sender, EventArgs e)
        {
            Hasta hasta = new Hasta();

            hasta.Ad    = txtUyeAdi.Text;
            hasta.Soyad = txtUyeSoyadi.Text;
            //hasta.TCKN = txtUyeTCKN.Text;
            //hasta.Telefon = txtUyeTelefon.Text;

            //MaskedTextBox kullandığımız için daha önce kullandığımız TextBox'ları pasifleştirdik.

            hasta.TCKN         = mskTxtTCKN.Text;
            hasta.Telefon      = mskTxtTelefon.Text;
            hasta.KullaniciAdi = txtUyeMail.Text;
            hasta.Sifre        = txtUyeSifre.Text;

            bool kaydedildiMi = hastaBLL.HastaKaydet(hasta);

            if (kaydedildiMi)
            {
                MessageBox.Show("Hasta başarıyla kaydedildi");
                foreach (Control item in groupBox2.Controls)
                {
                    if (item is TextBox)
                    {
                        TextBox tb = item as TextBox;

                        tb.Clear();
                    }

                    if (item is MaskedTextBox)
                    {
                        MaskedTextBox mtb = item as MaskedTextBox;
                        mtb.Clear();
                    }
                }
            }
            else
            {
                MessageBox.Show("HATA : Hasta eklenemedi");
            }

            //Burada hasta sisteme kaydolacak. Insert into Hastalar...
            //Insert ederken de şifrenin en az 8 en fazla 16 karakter olması ve özel karakter içermemesi gerekiyor.
        }
示例#25
0
 /**************************************************************************************************/
 public void temizle()
 {
     foreach (Control item in this.Controls)
     {
         if (item is TextBox)
         {
             TextBox txb = (TextBox)item;
             txb.Clear();
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox mtbox = (MaskedTextBox)item;
             mtbox.Clear();
         }
     }
     cmb_dogumyeri.SelectedIndex    = 0;
     cmb_ehliyet_turu.SelectedIndex = 0;
     txb_dogum.Text       = DateTime.Now.ToShortDateString();
     txb_ehliyet_trh.Text = DateTime.Now.ToShortDateString();
 }
示例#26
0
 public void Temizle()
 {
     foreach (Control item in this.Controls)
     {
         if (item is TextEdit)
         {
             TextEdit tb = (TextEdit)item;
             tb.Reset();
         }
         if (item is MaskedTextBox)
         {
             MaskedTextBox msk = (MaskedTextBox)item;
             msk.Clear();
         }
         if (item is RichTextBox)
         {
             RichTextBox rch = (RichTextBox)item;
             rch.Clear();
         }
     }
 }
示例#27
0
 public void ClearAll(Control ctrl)
 {
     foreach (Control item in ctrl.Controls)
     {
         if (item is TextBox)
         {
             TextBox a = (TextBox)item;
             a.Clear();
         }
         else if (item is RadioButton)
         {
             RadioButton b = (RadioButton)item;
             b.Checked = false;
         }
         else if (item is ComboBox)
         {
             ComboBox c = (ComboBox)item;
             c.SelectedIndex = -1;
         }
         else if (item is MaskedTextBox)
         {
             MaskedTextBox d = (MaskedTextBox)item;
             d.Clear();
         }
         else
         {
             if (item.Controls.Count > 0)
             {
                 ClearAll(item);
                 lbl_modifyerror.Hide();
                 lbl_insertedrecord.Hide();
                 lbl_updatedrecord.Hide();
                 lbl_deletedrecord.Hide();
             }
         }
     }
 }
示例#28
0
 private void cmdCancel_Click(object sender, EventArgs e)
 {
     txtImputMask.Clear();
     this.Close();
 }
示例#29
0
 public static void LimpiarTextBox(MaskedTextBox maskedTextBox)
 {
     maskedTextBox.Clear();
 }
示例#30
0
 public void LimpaMaskedTextBoxs(MaskedTextBox maskedTextBox)
 {
     maskedTextBox.Clear();
 }