Ejemplo n.º 1
0
 private void m_txtDoc_KeyDown_1(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (this.ListDor.SelectedItems.Count > 0)
         {
             clsEmployeeVO selectItem = new  clsEmployeeVO();
             selectItem = (clsEmployeeVO)this.ListDor.SelectedItems[0].Tag;
             this.m_txtDoc.Clear();
             this.m_txtDoc.Text   = selectItem.strName.Trim();
             this.m_txtDoc.Tag    = selectItem.strEmpID.Trim();
             this.m_txtNum.Tag    = selectItem.strEmpNO.Trim();
             this.ListDor.Visible = false;
             m_cboRegType.Focus();
         }
     }
     if (e.KeyCode == Keys.Up)
     {
         if (this.ListDor.SelectedItems.Count > 0 && this.ListDor.SelectedItems[0].Index != 0)
         {
             this.ListDor.Items[this.ListDor.SelectedItems[0].Index - 1].Selected = true;
             this.ListDor.Items[this.ListDor.SelectedItems[0].Index].EnsureVisible();
             this.m_txtDoc.Focus();
         }
     }
     if (e.KeyCode == Keys.Down)
     {
         if (this.ListDor.SelectedItems.Count > 0 && this.ListDor.SelectedItems[0].Index < this.ListDor.Items.Count - 1)
         {
             this.ListDor.Items[this.ListDor.SelectedItems[0].Index + 1].Selected = true;
             this.ListDor.Items[this.ListDor.SelectedItems[0].Index].EnsureVisible();
             this.m_txtDoc.Focus();
         }
     }
 }
Ejemplo n.º 2
0
 private void frmRegisterReport_Load(object sender, System.EventArgs e)
 {
     this.splitContainer1.Panel1Collapsed = true;
     ((clsControRegisterReport)this.objController).m_mthInitData();
     m_cboReport.Focus();
     this.m_cboRptPic.SelectedIndex = 0;
 }
Ejemplo n.º 3
0
 private void FocusToSearchBox()
 {
     //btnGo.Enabled = true;
     comboCode.Focus();
     comboCode.SelectionLength = 0;
     comboCode.SelectionStart  = comboCode.Text.Length;
 }
Ejemplo n.º 4
0
 private void butMoi_Click(object sender, System.EventArgs e)
 {
     l_id = 0;
     ena_object(true);
     madoituong.SelectedValue = i_madoituong.ToString();
     madoituong.Focus();
 }
Ejemplo n.º 5
0
 private void cmbGoodsName_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == 13 && cmbGoodsName.Text.Trim() != "")
     {
         string strSpell = cmbGoodsName.Text.Trim();
         this.FillComboBoxBySpell(cmbGoodsName, "GoodsSpell", "vcGoodsName", "vcSpell", strSpell);
         CMSMData.CMSMStruct.GoodsStruct gs = new CMSMData.CMSMStruct.GoodsStruct();
         err = null;
         gs  = cs.GetGoodsByName(cmbGoodsName.Text.Trim(), out err);
         if (gs != null)
         {
             txtGoodsID.Text   = gs.strGoodsID;
             cmbGoodsName.Text = gs.strGoodsName;
             txtPrice.Text     = gs.dPrice.ToString();
             txtCount.Text     = "1";
             cmbGoodsName.Focus();
         }
         else
         {
             if (err != null)
             {
                 clog.WriteLine(err);
             }
             MessageBox.Show("无此商品信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
             cmbGoodsName.Text = "请输入...";
             cmbGoodsName.Focus();
             return;
         }
     }
 }
Ejemplo n.º 6
0
 private bool kiemtra()
 {
     if (nhom.SelectedIndex == -1)
     {
         nhom.Focus();
         return(false);
     }
     if (phieu.SelectedIndex == -1)
     {
         phieu.Focus();
         return(false);
     }
     if (makp.SelectedIndex == -1)
     {
         makp.Focus();
         return(false);
     }
     if (matutruc.Visible && matutruc.SelectedIndex == -1)
     {
         matutruc.Focus();
         return(false);
     }
     if (makho.Items.Count == 0)
     {
         MessageBox.Show(lan.Change_language_MessageText("Chưa chọn kho dự trù !"), ttb.Msg);
         makp.Focus();
         return(false);
     }
     return(true);
 }
Ejemplo n.º 7
0
        private bool myDataGrid1_myKeyDown(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            try
            {
                DataTable tb         = (DataTable)this.myDataGrid1.DataSource;
                int       nrow       = this.myDataGrid1.CurrentCell.RowNumber;
                int       ncol       = this.myDataGrid1.CurrentCell.ColumnNumber;
                int       nkey       = Convert.ToInt32(keyData);
                string    columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim();
                if (nrow > tb.Rows.Count - 1)
                {
                    return(true);
                }

                //如果是名称列
                if (columnName.Trim() == "名称" && nkey == 13)
                {
                    string coltext = "";
                    DataGridTextBoxColumn txtCol = (DataGridTextBoxColumn)this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol];
                    coltext = txtCol.TextBox.Text;
                    if (coltext.Trim() == "")
                    {
                        return(true);
                    }

                    if (nrow >= tb.Rows.Count - 1)
                    {
                        DataRow row = tb.NewRow();
                        row["序号"] = nrow + 2;
                        tb.Rows.Add(row);
                    }

                    tb.Rows[nrow]["名称"]  = coltext;
                    tb.Rows[nrow]["拼音码"] = PubStaticFun.GetPYWBM(coltext, 0);
                    tb.Rows[nrow]["五笔码"] = PubStaticFun.GetPYWBM(coltext, 1);
                }

                //回车控制
                //if (nkey==13 && columnName!="药品类型")
                if (nkey == 13 && columnName != "统领分类")
                {
                    this.myDataGrid1.CurrentCell = new DataGridCell(nrow, ncol + 1);
                }
                //if (nkey==13 && columnName=="药品类型")
                if (nkey == 13 && (columnName == "统领分类" || columnName == "剂型大类"))
                {
                    this.myDataGrid1.CurrentCell = new DataGridCell(nrow + 1, 1);
                }
                if (this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol + 1].HeaderText.Trim() == "统领分类" || this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol + 1].HeaderText.Trim() == "剂型大类")
                {
                    cmbyplx.Focus();
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("错误" + err.Message);
            }
            return(false);
        }
Ejemplo n.º 8
0
 private void butMoi_Click(object sender, System.EventArgs e)
 {
     ena_object(true);
     mabs.Text = "";
     ten.Text  = "";
     loai.Focus();
     SendKeys.Send("{F4}");
 }
Ejemplo n.º 9
0
 private void cmbgkt_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         cmbpkt.Focus();
         SendKeys.Send("{f4}");
     }
 }
Ejemplo n.º 10
0
 private void butMoi_Click(object sender, System.EventArgs e)
 {
     ichandoan   = chandoan.SelectedIndex;
     id          = 0;
     ten.Text    = "";
     ghichu.Text = "";
     ena_object(true);
     loai.Focus();
 }
Ejemplo n.º 11
0
 private void cmdSua_Click(object sender, System.EventArgs e)
 {
     grb1.Visible = false;
     grb2.Visible = true;
     Ena_Textbox(true);
     cmbgbd.Focus();
     SendKeys.Send("{f4}");
     cmdKetthuc.Enabled = true;
 }
Ejemplo n.º 12
0
 private void butSua_Click(object sender, System.EventArgs e)
 {
     if (ds.Tables[0].Rows.Count == 0)
     {
         return;
     }
     ena_object(true);
     ten.Enabled = false;
     mucdo.Focus();
 }
Ejemplo n.º 13
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();
             }
         }
     }
 }
Ejemplo n.º 14
0
        private void myDataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
        {
            int    nrow       = this.myDataGrid1.CurrentCell.RowNumber;
            int    ncol       = this.myDataGrid1.CurrentCell.ColumnNumber;
            string columnName = this.myDataGrid1.TableStyles[0].GridColumnStyles[ncol].HeaderText.Trim();

            this.cmbkstype.Visible = false;
            if (columnName.Trim() == "科室类别")
            {
                DataTable tb = (DataTable)this.myDataGrid1.DataSource;
                if (nrow > tb.Rows.Count - 1)
                {
                    return;
                }

                this.cmbkstype.Visible = true;
                this.cmbkstype.Left    = this.myDataGrid1.GetCellBounds(nrow, ncol).Left + this.myDataGrid1.Left;
                this.cmbkstype.Top     = this.myDataGrid1.GetCellBounds(nrow, ncol).Top + this.myDataGrid1.Top;
                this.cmbkstype.Width   = this.myDataGrid1.GetCellBounds(nrow, ncol).Width;

                string code = Convert.ToString(tb.Rows[nrow]["code"]);
                if (code.Trim() != "")
                {
                    cmbkstype.Text = SeekType(code);
                }
                cmbkstype.Focus();
                return;
            }
        }
Ejemplo n.º 15
0
 private bool kiemtra()
 {
     if (ma.Text == "")
     {
         ma.Focus();
         return(false);
     }
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     if (computer.SelectedIndex == -1)
     {
         computer.Focus();
         return(false);
     }
     s_nhomkho = "";
     for (int i = 0; i < nhomkho.Items.Count; i++)
     {
         if (nhomkho.GetItemChecked(i))
         {
             s_nhomkho += dtnhom.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     s_makho = "";
     for (int i = 0; i < makho.Items.Count; i++)
     {
         if (makho.GetItemChecked(i))
         {
             s_makho += dtkho.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     return(true);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 檢查組合框是否已經選擇
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool CheckComboBox(ComboBox target)
        {
            if (target.SelectedItem == null)
            {
                target.Focus();
                return false;
            }

            if (target.Text == "")
            {
                target.Focus();
                return false;
            }

            return true;
        }
Ejemplo n.º 17
0
 private bool kiemtra()
 {
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     if (loai.SelectedIndex == -1)
     {
         loai.Focus();
         return(false);
     }
     s_nguon = "";
     for (int i = 0; i < nguon.Items.Count; i++)
     {
         if (nguon.GetItemChecked(i))
         {
             s_nguon += dtnguon.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     s_nhom = "";
     for (int i = 0; i < manhom.Items.Count; i++)
     {
         if (manhom.GetItemChecked(i))
         {
             s_nhom += dtnhom.Rows[i]["id"].ToString().Trim() + ",";
         }
     }
     return(true);
 }
Ejemplo n.º 18
0
        private bool kiemtra()
        {
            sql = ""; f1 = ""; f2 = "";
            if (loai.SelectedIndex == -1)
            {
                loai.Focus(); return(false);
            }
            if (phieu.SelectedIndex == -1)
            {
                phieu.Focus(); return(false);
            }
            if (makp.SelectedIndex == -1)
            {
                makp.Focus(); return(false);
            }
            switch (int.Parse(loai.SelectedValue.ToString()))
            {
            case 1: f1 = user + ".ttb_dutru"; break;

            case 2: f1 = user + ".ttb_xtutruc"; break;

            case 3: f1 = user + ".ttb_hoantra"; break;

            default: f1 = user + ".ttb_haophi"; break;
            }
            f2 = f1 + "ct"; f1 += "ll";
            return(true);
        }
Ejemplo n.º 19
0
 private bool kiemtra()
 {
     if (madoituong.SelectedIndex == -1)
     {
         madoituong.Focus();
         return(false);
     }
     r = m.getrowbyid(dthoten, "mabn='" + mabn.Text + "'");
     if (r == null)
     {
         MessageBox.Show(lan.Change_language_MessageText("Người bệnh không hợp lệ !"), LibMedi.AccessData.Msg);
         mabn.Focus();
         return(false);
     }
     else
     {
         s_denngay   = r["denngay"].ToString();
         l_mavaovien = long.Parse(r["mavaovien"].ToString());
         l_idkhoa    = long.Parse(r["id"].ToString());
     }
     if ((mabn.Text != "" && hoten.Text == "") || (mabn.Text == "" && hoten.Text != ""))
     {
         MessageBox.Show(lan.Change_language_MessageText("Họ tên người bệnh !"), LibMedi.AccessData.Msg);
         if (mabn.Text == "")
         {
             mabn.Focus();
         }
         else if (hoten.Text == "")
         {
             hoten.Focus();
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 20
0
        private bool kiemtra()
        {
            if (ten.Text == "")
            {
                ten.Focus();
                return(false);
            }
            //if (nhomcc.SelectedIndex==-1)
            //{
            //    nhomcc.Focus();
            //    return false;
            //}
            if (nhomin.SelectedIndex == -1)
            {
                nhomin.Focus();
                return(false);
            }

            /*
             *          if (nhomvp.SelectedIndex==-1)
             *          {
             *                  nhomvp.Focus();
             *                  return false;
             *          }*/
            return(true);
        }
Ejemplo n.º 21
0
        private bool kiemtra()
        {
            if (hoten.Text == "" || mabn1.Text == "" || mabn2.Text == "")
            {
                mabn1.Focus();
                return(false);
            }
            if (lydo.SelectedIndex == -1)
            {
                lydo.Focus();
                return(false);
            }
            if (ngayvao.SelectedIndex == -1)
            {
                ngayvao.Focus();
                return(false);
            }
            decimal l_maql = decimal.Parse(dsxml.Tables[0].Rows[ngayvao.SelectedIndex]["maql"].ToString());

            if (chkdoikhoanhapvien.Checked == false)
            {
                if (m.get_data("select * from " + user + ".v_theodoicongno where maql=" + l_maql).Tables[0].Rows.Count > 0)// || m.get_data("select * from v_vpkhoa where idkhoa="+l_id).Tables[0].Rows.Count>0)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Người bệnh này đã sử dụng các dịch vụ không cho phép xóa !"), LibMedi.AccessData.Msg);
                    return(false);
                }
            }
            if (m.get_data("select * from " + user + ".nhapkhoa where maql=" + l_maql).Tables[0].Rows.Count > 0)
            {
                MessageBox.Show(lan.Change_language_MessageText("Người bệnh này đã nhập khoa không cho phép xóa !"), LibMedi.AccessData.Msg);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 22
0
 private bool ValidateForm()
 {
     if (cmbServer.Text == String.Empty)
     {
         MessageBox.Show("You must select an SQL Server!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         cmbServer.Focus();
         return(false);
     }
     if (txtCWUser.Text == String.Empty)
     {
         MessageBox.Show("You must provide a CrawlWave username!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         txtCWUser.Focus();
         return(false);
     }
     if (txtCWPass.Text != txtCWPass2.Text)
     {
         MessageBox.Show("The passwords you provided do not match!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         txtCWPass.Focus();
         return(false);
     }
     if ((txtCWPass.Text == String.Empty) && (txtCWPass2.Text == String.Empty))
     {
         if (MessageBox.Show("You have provided an empty password. Are you sure the user has been configured with an empty password?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             txtCWPass.Focus();
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// ValidateDataToSearch
        /// </summary>
        /// <returns></returns>
        /// <author>Trada</author>
        /// <date>Friday, Feb 17 2006</date>
        private bool ValidateDataToSearch()
        {
            const string METHOD_NAME = THIS + ".ValidateDataToSearch()";

            try
            {
                if (FormControlComponents.CheckMandatory(cboYear))
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation);
                    cboYear.Focus();
                    return(false);
                }
                if (FormControlComponents.CheckMandatory(cboMonth))
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation);
                    cboMonth.Focus();
                    return(false);
                }
                if (FormControlComponents.CheckMandatory(txtCustomer))
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation);
                    txtCustomer.Focus();
                    return(false);
                }
                return(true);
            }
            catch (PCSException ex)
            {
                throw new PCSException(ex.mCode, METHOD_NAME, ex);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 24
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (NameTextBox.Text == "")
            {
                MessageBox.Show("Please enter a name for the new user", "Missing data");
                NameTextBox.Focus();
                return;
            }

            if (ClassComboBox.Text == "New class..." || ClassComboBox.Text == "")
            {
                MessageBox.Show("Please select a user category", "Missing data");
                ClassComboBox.Focus();
                return;
            }

            if (BlessTargetComboBox.Text == "")
            {
                MessageBox.Show("Please select a bless target", "Missing data");
                BlessTargetComboBox.Focus();
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Ejemplo n.º 25
0
        private bool kiemtra()
        {
            if (ma.Text == "")
            {
                ma.Focus();
                return(false);
            }
            if (hoten.Text == "")
            {
                hoten.Focus();
                return(false);
            }
            if (viettat.Text == "")
            {
                viettat.Text = ma.Text;
            }
//			if (makp.SelectedIndex==-1 && mapk.SelectedIndex==-1)
//			{
//				makp.Focus();
//				return false;
//			}
            if (nhom.SelectedIndex == -1)
            {
                nhom.Focus();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 26
0
 private void RadioButton1_CheckedChanged(System.Object sender, System.EventArgs e)
 {
     cbMaterialType.Enabled = true;
     TextBox1.Enabled       = false;
     TextBox2.Enabled       = false;
     cbMaterialType.Focus();
 }
Ejemplo n.º 27
0
 private bool kiemtra()
 {
     if (viettat.Text == "")
     {
         viettat.Focus();
         return(false);
     }
     if (ten.Text == "")
     {
         ten.Focus();
         return(false);
     }
     else
     {
         ten.Text = ten.Text.Replace("(", "[");
         ten.Text = ten.Text.Replace(")", "]");
     }
     if (makp.SelectedIndex == -1)
     {
         makp.Focus();
         return(false);
     }
     if (mavp.SelectedIndex == -1)
     {
         mavp.Focus();
         return(false);
     }
     return(true);
 }
Ejemplo n.º 28
0
 private void butChon_Click(object sender, System.EventArgs e)
 {
     if (makp.SelectedIndex == -1)
     {
         makp.Focus(); return;
     }
     if (phieu.SelectedIndex == -1)
     {
         phieu.Focus(); return;
     }
     s_phieu = "";
     if (phieudutru.CheckedItems.Count > 0)
     {
         for (int i = 0; i < phieudutru.Items.Count; i++)
         {
             if (phieudutru.GetItemChecked(i))
             {
                 s_phieu += dtph.Rows[i]["id"].ToString().Trim() + ",";
             }
         }
     }
     s_tu    = tu.Text; s_den = den.Text; i_phieu = int.Parse(phieu.SelectedValue.ToString()); i_makp = int.Parse(makp.SelectedValue.ToString());
     s_tenkp = makp.Text;
     if (ttb.get_duyet(s_mmyy, i_makp, i_nhom, i_loai, i_phieu, s_ngay, s_makho))
     {
         MessageBox.Show("Ngày " + s_ngay + "\nKhoa " + makp.Text + "\nPhiếu " + phieu.Text + "\nĐã duyệt !", ttb.Msg);
         return;
     }
     this.Close();
 }
Ejemplo n.º 29
0
 private void radExplain_CheckedChanged(object sender, System.EventArgs e)
 {
     if (radExplain.Checked == true)
     {
         gBoxExplain.Enabled = true;
         gBoxOPS.Enabled     = false;
         cmbExplain.Focus();
     }
     else
     {
         gBoxOPS.Enabled     = true;
         gBoxExplain.Enabled = false;
         this.dTimePicker1.Focus();
         default_usage = "";
     }
 }
 private void nazwa_t_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         comboBox1.Focus();
     }
 }
Ejemplo n.º 31
0
        private void WzPageDesignerProperties_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (_IsLoaded)
                {
                    return;
                }

                foreach (string strDataType in DesignerVariableType.ToArray())
                {
                    cmbDesignerPropertyDataType.Items.Add(strDataType);
                }
                //cmbDesignerPropertyDataType.Text = strDataTypes[0];
                cmbDesignerPropertyDataType.SelectedIndex = 0;

                _IsLoaded = true;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Trace.WriteLine(err.Message + Environment.NewLine + err.StackTrace);
            }
            cmbDesignerPropertyDataType.Focus();
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Indicates whether the Specified single Combobox is not Empty/Null.
 /// </summary>
 /// <param name="combobox">Combobox</param>
 /// <returns>
 /// Boolean Value
 /// </returns>
 public static bool IsValidComboBox(ComboBox combobox)
 {
     if (combobox.SelectedIndex == -1)
     {
         combobox.Focus();
         return false;
     }
     return true;
 }
 public bool IsSelected(ComboBox comboBox)
 {
     if (Convert.ToInt32(comboBox.SelectedIndex) == -1)
     {
         MessageBox.Show("Du måste välja ett värde i listan!");
         comboBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 34
0
 //method to check for blank combobox entry
 public static bool ComboContainsData(ComboBox comboBox, string name)
 {
     if (comboBox.Text == "")
     {
         MessageBox.Show(name + " cannot be blank. Please make a selection from the combo box and resubmit.", Title);
         comboBox.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 35
0
 public static bool IsSelected(ComboBox combo)
 {
     if (combo.Text == "")
     {
         MessageBox.Show(combo.Tag + " is a required field.", Title);
         combo.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 36
0
 //Check sendAs email is selected
 public bool checkSendAsEmail(ComboBox ddList)
 {
     int emailIndex = ddSendAs.SelectedIndex;
     if (emailIndex == 0)
     {
         MessageBox.Show("Please check a valid 'Send As' Email Address", "Confirm 'Send As' Email");
         ddList.Focus();
         return false;
     }
     else
     {
         return true;
     }
 }
Ejemplo n.º 37
0
 internal static bool ComboEmpty(ComboBox combo, object strip = null, int Index = 0)
 {
     bool result = false;
     if (combo.SelectedIndex == -1)
     {
         result = true;
         MessageBox.Show("Please select an option from the list", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         //UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: http://www.vbtonet.com/ewis/ewi2080.aspx
         if (!Index.Equals(0))
         {
             //strip.SelectedItem = strip.Tabs(Index)
         }
         combo.Focus();
     }
     else
     {
         result = false;
     }
     return result;
 }
Ejemplo n.º 38
0
 private bool EmptyCheck(ComboBox cbb, string caption)
 {
     if (cbb.Text.Trim() == string.Empty)
     {
         MessageBox.Show("������" + caption + "!", this.Text);
         cbb.Focus();
         return false;
     }
     return true;
 }
Ejemplo n.º 39
0
 public static string err_null_data_cbx(ComboBox temp)
 {
     if (temp.Text == null || temp.Text == "")
     {
         temp.Focus();
         return "Trường này không được để trống!";
     }
     else return null;
 }
 private void LoadAlmCustomFieldSuccessful(List<string> AlmCustomFieldsList, ComboBox AlmCustomField, string CustomFieldLabel)
 {
     AlmProjectGroup.Invoke(new MethodInvoker(delegate
     {
         AlmCustomField.Items.Clear();
         if (AlmCustomFieldsList.Count > 0)
         {
             AlmCustomField.Items.AddRange(AlmCustomFieldsList.ToArray());
             AlmCustomField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
         }
         LogMessage("Finished loading " + CustomFieldLabel + "s.");
         AlmCustomField.Enabled = true;
         AlmCustomField.Focus();
     }));
 }
Ejemplo n.º 41
0
		public userChoice( string title, string text, string[] choices, int Default, string ok, string cancel )
		{
			platformSpec.manageWindows.setUserInputSize( this );
			platformSpec.setFloatingWindow.before( this );
		//	this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 
			this.ControlBox = false; 

			int space = 8;
			this.Text = title; 
		//	this.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width * 3 / 4; 

			Label lbl = new Label();
			lbl.Text = text;
			lbl.Top = space;
			lbl.Left = space;
			lbl.Width = this.Width - 2 * space;

			System.Drawing.Bitmap bmp = new System.Drawing.Bitmap( 1, 1 );
			System.Drawing.Graphics g = System.Drawing.Graphics.FromImage( bmp );
			string[] words = text.Split( " ".ToCharArray() );
			int lines = 1, lineWidth = 0;
			for ( int i = 0; i < words.Length; i++ )
			{
				lineWidth += (int)g.MeasureString( words[ i ] + ( i < words.Length - 1? " " : "" ), lbl.Font ).Width;
				if ( lineWidth >= lbl.Width )
				{
					lines++;
					lineWidth = 0;
					i--;
				}
			}

			lbl.Height = lines * (int)g.MeasureString( words[0 ] + " ", lbl.Font ).Height;

			g.MeasureString( text, lbl.Font );

			cb = new ComboBox();

			cb.Left = space;
			cb.Top = lbl.Bottom + space;
			cb.Width = this.ClientSize.Width - 2 * space;
			for ( int i = 0; i < choices.Length; i++ )
				cb.Items.Add( choices[ i ] );

			cb.SelectedIndex = Default;

			Button cmdOk = new Button();
			cmdOk.Width = ( this.ClientSize.Width - 3 * space ) / 2;
			cmdOk.Left = space;
			cmdOk.Top = cb.Bottom + space;
			cmdOk.Text = ok; //language.getAString();//language.order.ok );//ok;
			cmdOk.Click += new EventHandler(cmdOk_Click);
#if !CF
			cmdOk.FlatStyle = FlatStyle.System;
#endif
			
			Button cmdCancel = new Button();
			cmdCancel.Width = ( this.ClientSize.Width - 3 * space ) / 2;
			cmdCancel.Left = space + cmdOk.Right;
			cmdCancel.Top = cb.Bottom + space;
			cmdCancel.Text = cancel; //language.getAString(); //language.order.cancel );//cancel;
			cmdCancel.Click += new EventHandler(cmdCancel_Click);
#if !CF
			cmdCancel.FlatStyle = FlatStyle.System;
#endif

			this.Controls.Add( lbl );
			this.Controls.Add( cmdOk );
			this.Controls.Add( cmdCancel );
			this.Controls.Add( cb );

			platformSpec.resolution.set( this.Controls );

			this.ClientSize = new Size( this.ClientSize.Width, space * 4 + lbl.Height + cb.Height + cmdOk.Height ); // this.Height = space * 4 + lbl.Height + cb.Height + cmdOk.Height;

			platformSpec.setFloatingWindow.after( this );
			
			this.ClientSize = new Size( this.ClientSize.Width, space + cmdOk.Bottom ); //.Height = space * 4 + lbl.Height + tb.Height + cmdOk.Height;

			this.Top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;
			this.Left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;

			cb.Focus();
		}
Ejemplo n.º 42
0
        //validation for making sure a combobox has been selected
        public bool isSelected(ComboBox combobox, string name)
        {
            if (combobox.SelectedIndex < 0)
            {
                MessageBox.Show("You must select an item from " + name);
                combobox.Focus();
                return false;
            }

            return true;
        }
Ejemplo n.º 43
0
        private void CmboboxOther_TextChanged(object sender, EventArgs e)
        {
            cmbMainCate = new ComboBox();
            cmbSubCate = new ComboBox();
            txt = new TextBox();

            Control ControlM = this.tableLayoutPanel5.GetControlFromPosition(0, 2); this.tableLayoutPanel5.Controls.Remove(ControlM);
            Control ControlS = this.tableLayoutPanel5.GetControlFromPosition(0, 3); this.tableLayoutPanel5.Controls.Remove(ControlS);
            if (CmboboxOther.Text == "หมวดสินค้า")
            {
                this.tableLayoutPanel5.Controls.Add(cmbMainCate, 0, 2);
                cmbMainCate.Dock = System.Windows.Forms.DockStyle.Fill;
                cmbMainCate.Font = new System.Drawing.Font("Tahoma", 9.75F);
                cmbMainCate.FormattingEnabled = true;
                cmbMainCate.Location = new System.Drawing.Point(3, 52);
                cmbMainCate.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
                cmbMainCate.Name = "cmbMainCate";
                cmbMainCate.Size = new System.Drawing.Size(166, 24);
                cmbMainCate.TextChanged += new System.EventHandler(cmbMainCate_TextChanged);
                LoadData_cmbMainCate(cmbMainCate);
                cmbMainCate.Focus();

                this.tableLayoutPanel5.Controls.Add(cmbSubCate, 0, 3);
                cmbSubCate.Dock = System.Windows.Forms.DockStyle.Fill;
                cmbSubCate.Font = new System.Drawing.Font("Tahoma", 9.75F);
                cmbSubCate.FormattingEnabled = true;
                cmbSubCate.Location = new System.Drawing.Point(3, 52);
                cmbSubCate.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
                cmbSubCate.Name = "cmbSubCate";
                cmbSubCate.Size = new System.Drawing.Size(166, 24);
                LoadData_cmbSubCate(cmbMainCate, cmbSubCate);
            }
            else if (CmboboxOther.Text == "รหัสสินค้า" || CmboboxOther.Text == "ชื่อสินค้า")
            {
                this.tableLayoutPanel5.Controls.Add(txt, 0, 2);
                txt.KeyDown += txt_KeyDown;
                txt.Dock = System.Windows.Forms.DockStyle.Fill;
                txt.Font = new System.Drawing.Font("Tahoma", 9.75F);
                txt.Location = new System.Drawing.Point(3, 52);
                txt.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
                txt.Name = "txt";
                txt.Size = new System.Drawing.Size(166, 23);
                txt.Focus();
            }
        }
Ejemplo n.º 44
0
 public static void ShowInvlaidCodeMessage(ComboBox cbo, Modules module)
 {
     MessageBox.Show(string.Format("Error ! Invalid {0} Code" + Environment.NewLine + "Please Select a Valid {0} Code.", module.ToString()), module.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
     cbo.Focus();
     if (cbo.Items.Count > 0)
         cbo.SelectedIndex = 0;
     cbo.Focus();
 }
Ejemplo n.º 45
0
        //presence validation for if a combo box is selected
        public bool isSelected(ComboBox combobox, string name)
        {
            if (combobox.SelectedIndex < 0)
            {
                MessageBox.Show(name + " must be selected", "Error");
                combobox.Refresh();
                combobox.Focus();
                return false;
            }

            return true;
        }
Ejemplo n.º 46
0
        /// <summary>
        /// Shows a form for choosing the language file from all other files.
        /// </summary>
        /// <returns>the DialogResult of this Form</returns>
        public static Form.DialogResult ChooseLanguage()
        {
            Directory.CreateDirectory(Program.ExePath + @"\temp");
            Languages.Zip.ExtractAll(Program.ExePath + @"\Languages.dll", Program.ExePath + @"\temp");

            Form.Form form = new Form.Form();

            Form.ComboBox list_languages = new Form.ComboBox();
            Form.Label lb_text = new System.Windows.Forms.Label();
            Form.Button bt_add = new System.Windows.Forms.Button();
            Form.Button bt_ok = new System.Windows.Forms.Button();

            list_languages.Location = new System.Drawing.Point(16, 48);
            list_languages.Size = new System.Drawing.Size(266, 21);
            list_languages.TabIndex = 0;
            {
                string[] files = Directory.GetFiles(Program.ExePath + @"\temp");
                if (files.Length > 0)
                    list_languages.Text = Path.GetFileNameWithoutExtension(files[0]);
                System.Array.Sort(files);
                foreach (string a in files)
                    if (!list_languages.Items.Contains(new Form.ListViewItem(Path.GetFileNameWithoutExtension(a))))
                        list_languages.Items.Add(Path.GetFileNameWithoutExtension(a));
            }

            lb_text.AutoSize = true;
            lb_text.Location = new System.Drawing.Point(13, 13);
            lb_text.Size = new System.Drawing.Size(92, 13);
            lb_text.TabIndex = 1;
            lb_text.Text = "choose language:";
            bt_add.Location = new System.Drawing.Point(169, 94);
            bt_add.Size = new System.Drawing.Size(113, 23);
            bt_add.TabIndex = 2;
            bt_add.Text = "Add Language to list";
            bt_add.UseVisualStyleBackColor = true;
            bt_add.Click += delegate
            {
                string path = Program.SelectFile("XML files (*.xml)|*.xml|All files (*.*)|*.*","Open");
                if (path != null)
                {
                    string textInZip = Languages.Convertor.getLanguageText(path);
                    Languages.Convertor.ConvertToLanguageFile(path, Program.ExePath + @"\" + textInZip + ".xml");
                    Languages.Zip.AddFile(Program.ExePath + @"\" + textInZip + ".xml", textInZip + ".xml");
                    if (!list_languages.Items.Contains(Path.GetFileNameWithoutExtension(textInZip)))
                        list_languages.Items.Add(Path.GetFileNameWithoutExtension(textInZip));
                    Languages.Convertor.ChosenLanguage_FilePath = Program.ExePath + @"\temp\" + textInZip + ".xml";
                    list_languages.SelectedIndex = 0;
                    File.Delete(Program.ExePath + @"\" + textInZip + ".xml");
                }
            };

            bt_ok.Location = new System.Drawing.Point(80, 142);
            bt_ok.Size = new System.Drawing.Size(109, 35);
            bt_ok.TabIndex = 3;
            bt_ok.Text = "OK";
            bt_ok.UseVisualStyleBackColor = true;
            bt_ok.Click += delegate
            {
                form.DialogResult = Form.DialogResult.OK;
                properties.chosenLanguage = list_languages.Text;
                form.Close();
            };

            form.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            form.AutoScaleMode = Form.AutoScaleMode.Font;
            form.ClientSize = new System.Drawing.Size(303, 255);
            form.MinimumSize = new System.Drawing.Size(303, 255);
            form.MaximumSize = new System.Drawing.Size(303, 255);
            form.MaximizeBox = false;
            form.MinimizeBox = false;
            form.Controls.AddRange(new Form.Control[] { list_languages, lb_text, bt_add, bt_ok });
            form.Icon = new System.Drawing.Icon(Peulot_Heshbon.Properties.Resources.App_Icon, new System.Drawing.Size(32, 32));
            form.Text = "Choose Language";
            form.ResumeLayout(false);
            form.PerformLayout();
            form.DialogResult = Form.DialogResult.Cancel;

            list_languages.Focus();

            Form.DialogResult dg = form.ShowDialog();
            Directory.Delete(Program.ExePath + @"\temp", true);

            return dg;
        }
Ejemplo n.º 47
0
        /// <summary>
        /// 检查表达式
        /// </summary>
        /// <param name="cmbLeftBrackets">左括号</param>
        /// <param name="cmbColumn">列</param>
        /// <param name="cmbCondition">条件</param>
        /// <param name="txtValue">值</param>
        /// <param name="cmbValue">选项值</param>
        /// <param name="cmbRightBrackets">右括号</param>
        /// <returns>正确</returns>
        private bool SubCheckInput(ComboBox cmbLeftBrackets, ComboBox cmbColumn, ComboBox cmbCondition, TextBox txtValue, ComboBox cmbValue, ComboBox cmbRightBrackets)
        {
            bool returnValue = true;
            if (cmbColumn.SelectedIndex > 0)
            {
                if (cmbCondition.SelectedItem == null)
                {
                    MessageBox.Show(AppMessage.MSG9919, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmbCondition.Focus();
                    returnValue = false;
                }
                if (cmbValue.Visible)
                {
                    if (cmbValue.SelectedItem == null)
                    {
                        MessageBox.Show(AppMessage.MSG9920, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        cmbValue.Focus();
                        returnValue = false;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(txtValue.Text))
                    {
                        MessageBox.Show(AppMessage.MSG9920, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtValue.Focus();
                        returnValue = false;
                    }
                }
            }

            return returnValue;
        }
Ejemplo n.º 48
0
 public static bool IsValidateComboBoxSuccess(ComboBox comboBox, string messageString)
 {
     if (string.IsNullOrEmpty(comboBox.Text.Trim()))
     {
         comboBox.Focus();
         MessageBox.Show(messageString);
         comboBox.Focus();
         return false;
     }
     else
     {
         return true;
     }
 }
        private void DeptSelectChanged(ComboBox dept, ComboBox emp)
        {
            //��ȡ��Ա�б�
            emp.Text = "";
            emp.Items.Clear();
            string sSql = "select emp_nam from emp where dept_nam = \'" + dept.Text + "\'";
            MySqlDataReader reader = MysqlHelper.ExecuteReader(sSql);
            while (reader.Read())
            {
                emp.Items.Add(reader["emp_nam"].ToString());
            }

            if (emp.Items.Count == 1)
            {
                emp.SelectedIndex = 0;
            }
            else
            {
                emp.Focus();
                emp.DroppedDown = true;
            }
        }
Ejemplo n.º 50
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="lst"></param>
        /// <param name="x">鼠标的x坐标</param>
        /// <param name="y">鼠标的y坐标</param>
        /// <param name="col">ComboBox显示在哪个列上</param>
        /// <param name="defaultValueCol">ComboBox的默认值列</param>
        private static void ShowCombobox(ListView lv, ComboBox lst, int x, int y, int col, int defaultValueCol)
        {
            var item = lv.GetItemAt(x, y);
            if (item == null || !item.Checked)
                return;
            comboboxItem = item;

            int lWidth = 0, rWidth = 0;
            for (int i = 0; i <= col; i++)
            {
                int tmp = lv.Columns[i].Width;
                if (i < col)
                    lWidth += tmp;
                rWidth += tmp;
            }

            if (x > rWidth || x < lWidth)
            {
                lst.Visible = false;
                return;
            }

            //获取所在位置的行的Bounds            
            Rectangle rect = item.Bounds;
            //修改Rect的范围使其与第二列的单元格的大小相同,为了好看 ,左边缩进了2个单位                       
            rect.X += lv.Left + lWidth + 2;
            rect.Y += lv.Top + 2;
            rect.Width = rWidth - lWidth;
            lst.Bounds = rect;
            string val = item.SubItems[col].Text;
            if (string.IsNullOrEmpty(val) && defaultValueCol >= 0 && item.SubItems.Count > defaultValueCol)
                val = item.SubItems[defaultValueCol].Text;
            lst.Text = val;
            lst.Visible = true;
            lst.BringToFront();
            lst.Focus();
            lst.Name = col.ToString();

            //lst.SelectedIndexChanged -= lstSelectedIndexChanged;// (obj, args) => { MessageBox.Show("1"); };
        }