SelectAll() public method

public SelectAll ( ) : void
return void
示例#1
0
 private void PropertyView_DoubleClick(object sender, EventArgs e)
 {
     lvItem_ = this.GetItemAt(mx_, my_);
     if (lvItem_ != null)
     {
         int x1 = this.Columns[0].Width + 2;
         if (mx_ >= x1)
         {
             int      x2   = x1 + this.Columns[1].Width;
             int      r    = lvItem_.Index;
             Property prop = (Property)propList_[r];
             if (prop.isSelection())
             {
                 addSelections(prop.getOptions());
                 comboBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height);
                 comboBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 comboBox_.Show();
                 comboBox_.Text = lvItem_.SubItems[1].Text;
                 comboBox_.SelectAll();
                 comboBox_.Focus();
             }
             else
             {
                 editBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height - 2);
                 editBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                 editBox_.Show();
                 editBox_.Text = lvItem_.SubItems[1].Text;
                 editBox_.SelectAll();
                 editBox_.Focus();
             }
         }
     }
 }
示例#2
0
 private void cbType_Enter(object sender, System.EventArgs e)
 {
     if (cbType.Text.Length > 0)
     {
         cbType.SelectAll();
     }
 }
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (TextBox1.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                TextBox1.Focus();
                TextBox1.SelectAll();
                return;
            }
            if (TextBox2.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                TextBox2.Focus();
                TextBox2.SelectAll();
                return;
            }
            if (ComboBox1.Text.Trim() == "")
            {
                MessageBox.Show("not blank");
                ComboBox1.Focus();
                ComboBox1.SelectAll();
                return;
            }
            if (frmMode == 0)             //修改记录
            {
                if (MessageBox.Show("确定要修改当前物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (EditData(OldMaterialTypeCode, TextBox1.Text, TextBox2.Text, rms_var.GetDeptCode(ComboBox1.Text), CheckBox1.Checked))
                    {
                        MessageBox.Show("修改记录成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else             //添加记录
            {
                if (AddData(TextBox1.Text, TextBox2.Text, rms_var.GetDeptCode(ComboBox1.Text), CheckBox1.Checked))
                {
                    MessageBox.Show("添加记录成功!");
                    if (MessageBox.Show("继续添加新物品类别吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        TextBox1.Text     = "";
                        TextBox2.Text     = "";
                        ComboBox1.Text    = "";
                        CheckBox1.Checked = false;

                        TextBox1.Focus();
                        TextBox1.SelectAll();
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
        }
示例#4
0
        public void paramListView_DoubleClick(object sender, System.EventArgs e)
        {
            // Check the subitem clicked .
            int colStartX = 0;
            int colEndX   = paramListView.Columns[0].Width;

            for (int i = 0; i < paramListView.Columns.Count; i++)
            {
                if ((firstMouseClickPoint.X > colStartX) && (firstMouseClickPoint.X < colEndX))
                {
                    subItemSelected = i;
                    break;
                }

                colStartX = colEndX;

                if (i < (paramListView.Columns.Count - 1))
                {
                    colEndX += paramListView.Columns[i + 1].Width;
                }
            }

            subItemText = li.SubItems[subItemSelected].Text;

            foreach (InterceptedFunctionParameter fp in function.Parameters)
            {
                if (fp.Name == li.SubItems[0].Text)
                {
                    cmbBox.Items.Add(fp.TestValue);
                }
            }
            if ((string)cmbBox.Items[0] != IgnoreParamString)
            {
                cmbBox.Items.Add(IgnoreParamString);
            }

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

            if (colName == "Value")
            {
                Rectangle r = new Rectangle(colStartX, li.Bounds.Y, colEndX, li.Bounds.Bottom);
                cmbBox.Width    = colEndX - colStartX;
                cmbBox.Height   = li.Bounds.Bottom - li.Bounds.Top;
                cmbBox.Location = new System.Drawing.Point(colStartX, li.Bounds.Y);

                cmbBox.Show();

                cmbBox.Text = subItemText;
                cmbBox.SelectAll();
                cmbBox.Focus();
            }
        }
示例#5
0
 /// <summary>
 /// At program launch sets the program to not visible
 ///
 /// Otherwise it toggles visibility
 /// </summary>
 /// <param name="id">not used</param>
 public void Handler(int id)
 {
     if (atLaunch)
     {
         this.Opacity = 100;
         this.Visible = false;
         atLaunch     = false;
     }
     this.Visible = !this.Visible;
     if (this.Visible)
     {
         this.Activate();
         listBox.SelectAll();
     }
 }
示例#6
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();
            }
        }
示例#7
0
        /// <summary>
        /// Handling double mouse click for changing MetaData info of the loaded data columns
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListView1_MouseDoubleClick(object sender, forms.MouseEventArgs e)
        {
            forms.ListViewHitTestInfo info = listView1.HitTest(X, Y);
            var row     = info.Item.Index;
            var col     = info.Item.SubItems.IndexOf(info.SubItem);
            var colType = listView1.Items[3].SubItems[col];

            li = info.Item;
            subItemSelected = col;
            //only first and second Row process the mouse input
            if (li == null || row > 3 || row < 1 || col < 1)
            {
                return;
            }

            forms.ComboBox combo = null;
            if (row == 1)
            {
                combo = cmbBox1;
            }
            else if (row == 2)
            {
                combo = cmbBox2;
            }
            else if (row == 3)
            {
                combo = cmbBox3;
            }
            else
            {
                combo = cmbBox1;
            }

            var subItm = li.SubItems[col];

            if (combo != null)
            {
                combo.Bounds = subItm.Bounds;
                combo.Show();
                combo.Text = subItm.Text;
                combo.SelectAll();
                combo.Focus();
            }
        }
    public static void CargaCombo(string Consulta, System.Windows.Forms.ComboBox ComboBox, string Texto, string Codigo, bool Abrir, bool Seleccionar)
    {
        string    fp      = "";
        DataTable dtcombo = new DataTable();

        LlenarTabla_Mysql(ref dtcombo, Consulta);


        ComboBox.DataSource    = dtcombo;
        ComboBox.DisplayMember = Texto;
        ComboBox.ValueMember   = Codigo;
        if (Abrir == true)
        {
            ComboBox.DroppedDown = true;
        }
        if (Seleccionar == true)
        {
            ComboBox.SelectAll();
            ComboBox.Focus();
        }
    }
示例#9
0
 /// <include file='doc\WinBarComboBox.uex' path='docs/doc[@for="ToolStripComboBox.SelectAll"]/*' />
 public void SelectAll()
 {
     ComboBox.SelectAll();
 }
示例#10
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (frmMode == 1)             //添加记录
            {
                if (TextBox6.Text.Trim() == "")
                {
                    MessageBox.Show("客户编号不能为空!");
                    TextBox6.Focus();
                    TextBox6.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("客户姓名不能为空!");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("所属类别不能为空!");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }

                if (AddData(ComboBox1.Text, TextBox6.Text, TextBox2.Text, TextBox7.Text, TextBox3.Text, TextBox8.Text, TextBox4.Text, TextBox9.Text, TextBox5.Text, CheckBox1.Checked, NumericUpDown1.Text, TextBox10.Text, CheckBox2.Checked))
                {
                    MessageBox.Show("添加记录成功!");
                    if (MessageBox.Show("继续添加新客户吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        ComboBox1.Text       = "";
                        TextBox2.Text        = "";
                        TextBox3.Text        = "";
                        TextBox4.Text        = "";
                        TextBox5.Text        = "";
                        TextBox6.Text        = "";
                        TextBox7.Text        = "";
                        TextBox8.Text        = "";
                        TextBox9.Text        = "";
                        TextBox10.Text       = "";
                        NumericUpDown1.Value = 0;
                        CheckBox1.Checked    = false;
                        CheckBox2.Checked    = false;

                        ComboBox1.Focus();
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 2)             //修改记录
            {
                if (TextBox6.Text.Trim() == "")
                {
                    MessageBox.Show("客户编号不能为空!");
                    TextBox6.Focus();
                    TextBox6.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("客户姓名不能为空!");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("所属类别不能为空!");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }
                if (MessageBox.Show("确定要修改当前的客户信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (EditData(ComboBox1.Text, OldCustCode, TextBox6.Text, TextBox2.Text, TextBox7.Text, TextBox3.Text, TextBox8.Text, TextBox4.Text, TextBox9.Text, TextBox5.Text, CheckBox1.Checked, NumericUpDown1.Text, TextBox10.Text, CheckBox2.Checked))
                    {
                        MessageBox.Show("修改记录成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 3)             //查询
            {
                this.DialogResult = DialogResult.OK;
            }
        }
示例#11
0
    OnInvalidComboBox
    (
        ComboBox oComboBox,
        String sErrorMessage
    )
    {
        Debug.Assert(oComboBox != null);
        Debug.Assert(sErrorMessage != null && sErrorMessage != "");

        OnInvalidControl(oComboBox, sErrorMessage);
        oComboBox.SelectAll();
        return (false);
    }
示例#12
0
        protected override void OnDoubleClick(EventArgs e)
        {
            base.OnDoubleClick(e);
            if (currentListItem == null)
            {
                return;
            }


            // Check the subitem clicked .
            try
            {
                int nStart = lastX;
                int spos   = 0;
                int epos   = 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 + 1].Width;
                }

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

                //this causes a problem if the value is empty
                string colName = this.Columns[subItemSelected].Text;
                RaiseBeforeTaskChanged(GetTask(currentListItem.Index));
                //TODO: can this be generalized or made available in design mode?
                if (colName == "Status")
                {
                    Rectangle r = new Rectangle(spos, currentListItem.Bounds.Y, epos, currentListItem.Bounds.Bottom);
                    cmbBox.Size     = new System.Drawing.Size(epos - spos, currentListItem.Bounds.Bottom - currentListItem.Bounds.Top);
                    cmbBox.Location = new System.Drawing.Point(spos + 2, currentListItem.Bounds.Y + 1);
                    cmbBox.Visible  = true;
                    cmbBox.Show();
                    cmbBox.Text = subItemText;
                    cmbBox.SelectAll();
                    cmbBox.Focus();
                }
                else
                {
                    Rectangle r = new Rectangle(spos, currentListItem.Bounds.Y, epos, currentListItem.Bounds.Bottom);
                    editBox.Size     = new System.Drawing.Size(epos - spos, currentListItem.Bounds.Bottom - currentListItem.Bounds.Top);
                    editBox.Location = new System.Drawing.Point(spos + 2, currentListItem.Bounds.Y + 1);
                    editBox.Visible  = true;
                    editBox.Show();
                    editBox.Text = subItemText;
                    editBox.SelectAll();
                    editBox.Focus();
                }
                currentListItem.Checked = !currentListItem.Checked;                 //seems double-clicking switches the check state
            }
            catch (Exception exc)
            {
            }
        }
示例#13
0
        public void ListBoxItemDoubleClick(object sender, System.EventArgs e)
        {
            // Check the subitem clicked .
            if (this.SelectedItems.Count == 0)
            {
                return;
            }

            listSelectedRow = this.SelectedItems[0].Index;

            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;
                if (i + 1 > Columns.Count - 1)
                {
                    return;
                }
                epos += this.Columns[i + 1].Width;
            }

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

            if (colName == "Action")
            {
                //li.Checked = true;
                ComboBox cbAction = bActionInput ? ActionInputCmbBox : ActionCmbBox;

                cbAction.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                cbAction.Size     = new System.Drawing.Size(this.Columns[0].Width, li.Bounds.Bottom - li.Bounds.Top);

                cbAction.SelectedItem = this.SelectedItems[0].SubItems[0].Text;

                cbAction.Show();
                //cmbBox.Text = subItemText;
                cbAction.SelectAll();
                cbAction.Focus();
            }
            else if (colName == "Duration")
            {
                if (this.SelectedItems[0].Text != "E-mail Event Activity")
                {
                    DurationCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                    DurationCmbBox.Size     = new System.Drawing.Size(this.Columns[1].Width, li.Bounds.Bottom - li.Bounds.Top);

                    DurationCmbBox.SelectedItem = this.SelectedItems[0].SubItems[1].Text;

                    DurationCmbBox.Show();
                    //cmbBox.Text = subItemText;
                    DurationCmbBox.SelectAll();
                    DurationCmbBox.Focus();

                    //if ((this.ItemChecked) && (this.SelectedItems >= 0))
                    //if (this.Items[this.SelectedItems.].Checked)
                    //this.Items[this.SelectedItems].Checked = true;
                    //else
                    //this.Items[this.SelectedItems].Checked = false;
                }
            }
            else if (colName == "Reader ID")
            {
                ReaderCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                ReaderCmbBox.Size     = new System.Drawing.Size(this.Columns[2].Width, li.Bounds.Bottom - li.Bounds.Top);

                ReaderCmbBox.SelectedIndex = ReaderCmbBox.FindStringExact(this.SelectedItems[0].SubItems[2].Text);

                Rectangle rect = GetColumnLocation(4);
                LocationLabel.Location = new System.Drawing.Point(rect.X, li.Bounds.Y);
                LocationLabel.Size     = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top - 1);

                ReaderCmbBox.Show();
                //cmbBox.Text = subItemText;
                ReaderCmbBox.SelectAll();
                ReaderCmbBox.Focus();

//                LocationLabel.Show();
            }
            else if (colName == "FGen ID")
            {
                FGenCmbBox.Location = new System.Drawing.Point(spos, li.Bounds.Y);
                FGenCmbBox.Size     = new System.Drawing.Size(this.Columns[3].Width, li.Bounds.Bottom - li.Bounds.Top);

                FGenCmbBox.SelectedIndex = FGenCmbBox.FindStringExact(this.SelectedItems[0].SubItems[3].Text);

                Rectangle rect = GetColumnLocation(4);
                LocationLabel.Location = new System.Drawing.Point(rect.X, li.Bounds.Y);
                LocationLabel.Size     = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top - 1);

                FGenCmbBox.Show();
                //cmbBox.Text = subItemText;
                FGenCmbBox.SelectAll();
                FGenCmbBox.Focus();

//                LocationLabel.Show();
            }
            //else if (colName == "Location")
            //{
            //LocationLabel.Location = new System.Drawing.Point(spos, li.Bounds.Y);
            //LocationLabel.Size = new System.Drawing.Size(this.Columns[4].Width, li.Bounds.Bottom - li.Bounds.Top);
            //LocationLabel.Show();
            //}
        }
示例#14
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (frmMode == 1)             //添加记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("登录帐号不能为空!");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("雇员姓名不能为空!");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }
                if (CheckBox2.Checked)
                {
                    if (TextBox7.Text == "")
                    {
                        MessageBox.Show("PPC登录密码不能为空!");
                        TextBox7.Focus();
                        TextBox7.SelectAll();
                        return;
                    }
                }

                if (AddData(TextBox1.Text, rms_var.GetEmplCode(ComboBox1.Text), CheckBox1.Checked, CheckBox2.Checked, TextBox7.Text))
                {
                    MessageBox.Show("添加记录成功!");
                    if (MessageBox.Show("继续添加新的操作员吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        TextBox1.Text     = "";
                        ComboBox1.Text    = "";
                        CheckBox1.Checked = false;
                        TextBox1.Focus();
                        TextBox1.SelectAll();
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 2)             //修改记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("登录帐号不能为空!");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("雇员姓名不能为空!");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }
                if (CheckBox2.Checked)
                {
                    if (TextBox7.Text == "")
                    {
                        MessageBox.Show("PPC登录密码不能为空!");
                        TextBox7.Focus();
                        TextBox7.SelectAll();
                        return;
                    }
                }
                if (MessageBox.Show("确定要修改当前操作员信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (EditData(OldOPCode, TextBox1.Text, rms_var.GetEmplCode(ComboBox1.Text), CheckBox1.Checked, CheckBox2.Checked, TextBox7.Text))
                    {
                        MessageBox.Show("修改记录成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 3)             //查询
            {
                this.DialogResult = DialogResult.OK;
            }
        }
示例#15
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (frmMode == 1)             //添加记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("菜品编码不能为空!");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("菜品名不能为空!");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (TextBox3.Text.Trim() == "")
                {
                    MessageBox.Show("拼音码不能为空!");
                    TextBox3.Focus();
                    TextBox3.SelectAll();
                    return;
                }
                if (ComboBox2.Text.Trim() == "")
                {
                    MessageBox.Show("单位不能为空!");
                    ComboBox2.Focus();
                    ComboBox2.SelectAll();
                    return;
                }


                if (NumericUpDown1.Value == 0)                 //单价为空
                {
                    if (MessageBox.Show("单价为空,确定要添加吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (AddData(TextBox1.Text, ComboBox1.Text, Label3.Text, TextBox2.Text, TextBox3.Text, ComboBox2.Text, NumericUpDown1.Text, NumericUpDown5.Text, NumericUpDown2.Text, CheckBox3.Checked, CheckBox4.Checked, NumericUpDown3.Text, NumericUpDown4.Text, CheckBox1.Checked, CheckBox1.Checked, NumericUpDown6.Text, CheckBox5.Checked))
                        {
                            MessageBox.Show("添加记录成功!");
                            if (MessageBox.Show("继续添加新菜品吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                            {
                                TextBox1.Text = "";
                                TextBox2.Text = "";
                                TextBox3.Text = "";

                                ComboBox1.Text = "";
                                ComboBox2.Text = "";

                                NumericUpDown1.Value = 0;
                                NumericUpDown2.Value = 0;
                                NumericUpDown3.Value = 0;
                                NumericUpDown4.Value = 0;
                                NumericUpDown5.Value = 0;

                                CheckBox1.Checked = false;
                                CheckBox2.Checked = false;
                                CheckBox3.Checked = false;
                                CheckBox4.Checked = false;

                                ComboBox1.Focus();
                            }
                            else
                            {
                                this.DialogResult = DialogResult.OK;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else                 //单价不为空
                {
                    if (AddData(TextBox1.Text, ComboBox1.Text, Label3.Text, TextBox2.Text, TextBox3.Text, ComboBox2.Text, NumericUpDown1.Text, NumericUpDown5.Text, NumericUpDown2.Text, CheckBox3.Checked, CheckBox4.Checked, NumericUpDown3.Text, NumericUpDown4.Text, CheckBox1.Checked, CheckBox1.Checked, NumericUpDown6.Text, CheckBox5.Checked))
                    {
                        MessageBox.Show("添加记录成功!");
                        if (MessageBox.Show("继续添加新菜品吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                        {
                            TextBox1.Text = "";
                            TextBox2.Text = "";
                            TextBox3.Text = "";

                            ComboBox1.Text = "";
                            ComboBox2.Text = "";

                            NumericUpDown1.Value = 0;
                            NumericUpDown2.Value = 0;
                            NumericUpDown3.Value = 0;
                            NumericUpDown4.Value = 0;
                            NumericUpDown5.Value = 0;

                            CheckBox1.Checked = false;
                            CheckBox2.Checked = false;
                            CheckBox3.Checked = false;
                            CheckBox4.Checked = false;

                            ComboBox1.Focus();
                        }
                        else
                        {
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }
            }
            else if (frmMode == 2)             //修改记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("菜品编码不能为空!");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("菜品名不能为空!");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (TextBox3.Text.Trim() == "")
                {
                    MessageBox.Show("拼音码不能为空!");
                    TextBox3.Focus();
                    TextBox3.SelectAll();
                    return;
                }
                if (ComboBox2.Text.Trim() == "")
                {
                    MessageBox.Show("单位不能为空!");
                    ComboBox2.Focus();
                    ComboBox2.SelectAll();
                    return;
                }
                if (MessageBox.Show("确定要修改当前菜品信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (NumericUpDown1.Value == 0)
                    {
                        if (MessageBox.Show("单价为空,确定要添加吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            if (EditData(OldFoodCode, TextBox1.Text, ComboBox1.Text, Label3.Text, TextBox2.Text, TextBox3.Text, ComboBox2.Text, NumericUpDown1.Text, NumericUpDown5.Text, NumericUpDown2.Text, CheckBox3.Checked, CheckBox4.Checked, NumericUpDown3.Text, NumericUpDown4.Text, CheckBox1.Checked, CheckBox2.Checked, NumericUpDown6.Text, CheckBox5.Checked))
                            {
                                MessageBox.Show("修改记录成功!");
                                this.DialogResult = DialogResult.OK;
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (EditData(OldFoodCode, TextBox1.Text, ComboBox1.Text, Label3.Text, TextBox2.Text, TextBox3.Text, ComboBox2.Text, NumericUpDown1.Text, NumericUpDown5.Text, NumericUpDown2.Text, CheckBox3.Checked, CheckBox4.Checked, NumericUpDown3.Text, NumericUpDown4.Text, CheckBox1.Checked, CheckBox2.Checked, NumericUpDown6.Text, CheckBox5.Checked))
                        {
                            MessageBox.Show("修改记录成功!");
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }
            }
            else if (frmMode == 3)             //查询
            {
                this.DialogResult = DialogResult.OK;
            }
        }
示例#16
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 private bool CheckDatas()
 {
     try
     {
         if (GetStationID(cmbPoint.Text.Trim()) == -1)
         {
             MessageBox.Show(
                 "请填写站点名称",
                 "错误",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error
                 );
             cmbPoint.Focus();
             cmbPoint.SelectAll();
             return(false);
         }
         if (dtDate.Value.ToShortDateString() == "")
         {
             MessageBox.Show(
                 "请选择时间",
                 "错误",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error
                 );
             dtDate.Focus();
             return(false);
         }
         if (txtValue.Text.Trim() == string.Empty)
         {
             MessageBox.Show(
                 "请输入自来水表流量!",
                 "错误",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error
                 );
             return(false);
         }
         else
         {
             try
             {
                 m_Value = System.Convert.ToDecimal(txtValue.Text.Trim());
             }
             catch (InvalidCastException icex)
             {
                 MessageBox.Show(
                     "自来水表流量错误!\r\n" + icex.Message,
                     "错误",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Warning
                     );
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         // 2007.05.30
         //
         //MessageBox.Show("输入数据错误");
         ExceptionHandler.Handle("输入数据错误", ex);
         return(false);
     }
 }
示例#17
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            if (frmMode == 2)             //修改记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }
                if (MessageBox.Show("确定要修改当前物品信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (EditData(OldMaterialCode, TextBox1.Text, ComboBox1.Text, TextBox2.Text, TextBox3.Text, TextBox5.Text, TextBox4.Text, (double)NumericUpDown3.Value, (double)NumericUpDown1.Value, (double)NumericUpDown2.Value))
                    {
                        MessageBox.Show("修改记录成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 1)             //添加记录
            {
                if (TextBox1.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    TextBox1.Focus();
                    TextBox1.SelectAll();
                    return;
                }
                if (TextBox2.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    TextBox2.Focus();
                    TextBox2.SelectAll();
                    return;
                }
                if (ComboBox1.Text.Trim() == "")
                {
                    MessageBox.Show("not blank");
                    ComboBox1.Focus();
                    ComboBox1.SelectAll();
                    return;
                }
                if (AddData(TextBox1.Text, ComboBox1.Text, TextBox2.Text, TextBox3.Text, TextBox5.Text, TextBox4.Text, (double)NumericUpDown3.Value, (double)NumericUpDown1.Value, (double)NumericUpDown2.Value))
                {
                    MessageBox.Show("添加记录成功!");
                    if (MessageBox.Show("继续添加新物品吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        TextBox1.Text        = "";
                        TextBox2.Text        = "";
                        TextBox3.Text        = "";
                        TextBox4.Text        = "";
                        TextBox5.Text        = "";
                        NumericUpDown3.Value = 0;
                        NumericUpDown1.Value = 0;
                        NumericUpDown2.Value = 0;

                        TextBox1.Focus();
                        TextBox1.SelectAll();
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else if (frmMode == 3)             //查询
            {
                this.DialogResult = DialogResult.OK;
            }
        }
示例#18
0
        private void EditListView_MouseDown(object sender, MouseEventArgs e)
        {
            int mx = e.X;

            lvItem_ = this.GetItemAt(2, e.Y);
            if (lvItem_ == null)
            {
                if (this.Items.Count <= 0)
                {
                    lvItem_ = addItemWithSubItems("");
                }
                else if (!this.Items[this.Items.Count - 1].Text.Equals(""))
                {
                    lvItem_ = addItemWithSubItems("");
                }
                else
                {
                    lvItem_ = this.Items[this.Items.Count - 1];
                }
            }

            int x1 = 0;
            int x2 = this.Columns[0].Width;

            subItemSelected_ = 0;
            if (mx >= x2)
            {
                for (int i = 1; i < this.Columns.Count; i++)
                {
                    x1  = x2;
                    x2 += this.Columns[i].Width;
                    if (mx < x2)
                    {
                        subItemSelected_ = i;
                        break;
                    }
                }
            }
            x1          += 2;
            subItemText_ = lvItem_.SubItems[subItemSelected_].Text;
            string colName = this.Columns[subItemSelected_].Text;

            if (colName.Equals("Type"))
            {
                comboBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height - 2);
                comboBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                comboBox_.Show();
                comboBox_.Text = subItemText_;
                comboBox_.SelectAll();
                comboBox_.Focus();
            }
            else
            {
                editBox_.Size     = new System.Drawing.Size(x2 - x1, lvItem_.Bounds.Height);
                editBox_.Location = new System.Drawing.Point(x1, lvItem_.Bounds.Top);
                editBox_.Show();
                editBox_.Text = subItemText_;
                editBox_.SelectAll();
                editBox_.Focus();
            }
        }