Exemplo n.º 1
0
 private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     ComboBox combo = e.Control as ComboBox;
     if (combo != null)
     {
         combo.SelectedIndexChanged -= new EventHandler(ComboBox_SelectedIndexChanged);
         combo.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
     }
     TextBox tx = e.Control as TextBox;
     DataGridViewTextBoxCell cell = dataGridView1.CurrentCell as DataGridViewTextBoxCell;
     if (tx != null && cell.OwningColumn == dataGridView1.Columns["ColRate"])
     {
         tx.TextChanged -= new EventHandler(txtRate_TextChanged);
         tx.TextChanged += new EventHandler(txtRate_TextChanged);
     }
     if (tx != null && cell.OwningColumn == dataGridView1.Columns["ColQTY"])
     {
         tx.TextChanged -= new EventHandler(txtQty_TextChanged);
         tx.TextChanged += new EventHandler(txtQty_TextChanged);
     }
     if (tx != null && cell.OwningColumn == dataGridView1.Columns["txtScheme"])
     {
         tx.TextChanged -= new EventHandler(txtScheme_TextChanged);
         tx.TextChanged += new EventHandler(txtScheme_TextChanged);
     }
 }
Exemplo n.º 2
0
 void GRD_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     if (e.Control is DurationInputBoxEditingControl)
     {
         durationInputBox = GRD.EditingControl as DurationInputBox;
     }
 }
 private void grd_Error_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
 {
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 2)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
 }
        private void dataGridViewDistances_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            var textbox = (TextBox)e.Control;

            if (dataGridViewDistances.CurrentCell.ColumnIndex != 0)
            {
                textbox.AutoCompleteMode = AutoCompleteMode.None;
                return;
            }
            
            textbox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            textbox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            var items = new AutoCompleteStringCollection();

            var enteredSystems = GetEnteredSystems();
            items.AddRange((
                from s
                in SystemData.SystemList
                where s.HasCoordinate && (s.name == textbox.Text || !enteredSystems.Contains(s))
                orderby s.name ascending
                select s.name
            ).ToArray());
            
            textbox.AutoCompleteCustomSource = items;
        }
        private void indexGrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            Type t = e.Control.GetType();
            if (t != typeof(DataGridViewComboBoxEditingControl)) return;

            DataGridViewComboBoxEditingControl ec = e.Control as DataGridViewComboBoxEditingControl;
            ec.DrawMode = DrawMode.OwnerDrawFixed;
            ec.DrawItem += new DrawItemEventHandler(dropdown_DrawItem);

            if (indexGrid.CurrentCell.ColumnIndex == 0)
            {
                // now we need to set the item list to all non used columns and the option of 
                // NONE
                ec.Items.Clear();
                ec.Items.Add("<None>");
                foreach (string s in columnNames)
                {
                    bool alreadyUsed = false;
                    if (s != (string)indexGrid.CurrentRow.Cells[0].Value)
                        foreach (IndexColumnGridRow row in gridRows)
                            if (row.ColumnName == s)
                            {
                                alreadyUsed = true;
                                break;
                            }
                    if (!alreadyUsed)
                        ec.Items.Add(s);
                }
                int index = ec.FindStringExact(indexGrid.CurrentRow.Cells[0].Value as string);
                if (index > 0)
                    ec.SelectedIndex = index;
            }
        }
Exemplo n.º 6
0
 private void dataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) {
     _ShipCombo = e.Control as ComboBox;
     if (_ShipCombo != null) {
         _ShipCombo.DropDownStyle = ComboBoxStyle.Simple;
         _ShipCombo.AutoCompleteMode  = AutoCompleteMode.SuggestAppend;
         _ShipCombo.AutoCompleteSource = AutoCompleteSource.ListItems;
     }
 }
Exemplo n.º 7
0
 private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     if (dataGridView1.CurrentCell.ColumnIndex == 0)
     {
         TextBox tb = e.Control as TextBox;
         tb.KeyPress += new KeyPressEventHandler(tb_KeyPress);
     }
 }
 private void DataGridView1_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
 {
     if (e.Control is TextBox)
     {
         ((TextBox)e.Control).KeyPress -= TextBox_KeyPress;
         ((TextBox)e.Control).KeyPress += TextBox_KeyPress;
     }
 }
Exemplo n.º 9
0
        private void dataGridView1_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
        {
            TextBox textBox = e.Control as TextBox;

            if (textBox != null)
            {
                textBox.KeyPress += new KeyPressEventHandler(EditingControl_KeyPress);
            }
        }
 private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     if (e.Control.GetType().BaseType.Name == "TextBox")
     {
         control = (TextBox)e.Control;
         //需要限制输入数字的单元格
         control.KeyPress += new KeyPressEventHandler(validating_KeyPress);
     }
 }
        private void cartDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            ComboBox combo = e.Control as ComboBox;

            if (combo != null)
            {
                combo.SelectedIndexChanged -= new EventHandler(ComboBox_SelectedIndexChanged);
                combo.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
            }
        }
Exemplo n.º 12
0
        private void dgvLineaCompra_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            dgvCombo = e.Control as DataGridViewComboBoxEditingControl;

            if (dgvCombo != null)
            {
                dgvCombo.SelectedIndexChanged += new EventHandler(dgvLineaCompra_SelectedIndexChanged);
            }

        }
Exemplo n.º 13
0
 private void DirectoryCmdView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     DataGridViewComboBoxEditingControl comboControl = e.Control as DataGridViewComboBoxEditingControl;
     if (comboControl != null) {
         // Set the DropDown style to get an editable ComboBox
         if (comboControl.DropDownStyle != ComboBoxStyle.DropDown) {
             comboControl.DropDownStyle = ComboBoxStyle.DropDown;
         }
     }
 }
Exemplo n.º 14
0
 public static void dgvCellEditing(DataGridView dgv,string columnName, DataGridViewEditingControlShowingEventArgs e)
 {
     if (dgv.CurrentCell != null && dgv.CurrentCell.ColumnIndex == dgv.Columns[columnName].Index)
     {
         Control cntObject = new Control();
         e.Control.TextChanged += new EventHandler((object sse, EventArgs se) => Utilities.Cell_TextChanged(sse, dgv, cntObject));
         cntObject = e.Control;
         cntObject.TextChanged += (object sse, EventArgs se) => Utilities.Cell_TextChanged(sse, dgv, cntObject);
     }
     dgv.RefreshEdit();
 }
Exemplo n.º 15
0
 private void bonusDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     e.Control.KeyPress -= new KeyPressEventHandler(Column1_KeyPress);
     if ((bonusDataGridView.CurrentCell.ColumnIndex == 4)|| (bonusDataGridView.CurrentCell.ColumnIndex == 5))
     {
         TextBox tb = e.Control as TextBox;
         if (tb != null)
         {
             tb.KeyPress += new KeyPressEventHandler(Column1_KeyPress);
         }
     }
 }
Exemplo n.º 16
0
 private void grvStock_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     if (e.Control is DataGridViewTextBoxEditingControl)
     {
         DataGridViewTextBoxEditingControl txtBox = (DataGridViewTextBoxEditingControl)e.Control;
         txtBox.KeyPress -= new KeyPressEventHandler(Control_KeyPress);
         if (this.grvStock.CurrentCell.OwningColumn.Index == indexQTY)
         {
             txtBox.KeyPress += new KeyPressEventHandler(Control_KeyPress);
         }
     }
 }
Exemplo n.º 17
0
        private void DataGridView1_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
        {
            if (dataGridView1.CurrentCell.ColumnIndex == 3)
            {
                ((TextBox)e.Control).KeyPress += TextBox_keyPress;
            }
            //else if (dataGridView1.CurrentCell.ColumnIndex == 1)
            //{
            //    ((TextBox)e.Control).KeyPress += TextBox_keyPress1;


            //}
        }
 /// <summary>
 /// Handler for when edits occur to statvarcombobox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvManualStatVarProps_EditingControlShowing(object sender,
 DataGridViewEditingControlShowingEventArgs e)
 {
     ComboBox mComboBox = e.Control as ComboBox;
     if (mComboBox != null)
     {
         mComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
         //mComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
         //mComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
         mComboBox.SelectionChangeCommitted -= OnSelectStatVarLevel;
         mComboBox.SelectionChangeCommitted += OnSelectStatVarLevel;
     };
 }
Exemplo n.º 19
0
        protected override void OnEditingControlShowing(System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
        {
            // Attempt to cast the EditingControl to a ComboBox.
            //this will only work if CurrentCell is a combobox column
            ComboBox cb = e.Control as ComboBox;

            //if it is a combobox column...
            if (cb != null)
            {
                cb.SelectedIndexChanged -= DGVComboIndexChanged;
                cb.SelectedIndexChanged += DGVComboIndexChanged;
            }
            base.OnEditingControlShowing(e);
        }
Exemplo n.º 20
0
        private void dgv_list_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            ComboBox cb = e.Control as ComboBox;
            if (cb != null)
            {
                // first remove event handler to keep from attaching multiple:
                cb.SelectedIndexChanged -= new
                EventHandler(cb_SelectedIndexChanged);

                // now attach the event handler
                cb.SelectedIndexChanged += new
                EventHandler(cb_SelectedIndexChanged);
            }
        }
Exemplo n.º 21
0
        private void dgvEntranceTable_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            DataGridView dgv = (sender as DataGridView);

            int column = dgv.CurrentCell.ColumnIndex;
            string name = dgv.Columns[column].DataPropertyName;

            if (name.Equals("SceneName") && e.Control is TextBox)
            {
                TextBox tb = e.Control as TextBox;
                tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                tb.AutoCompleteCustomSource = ROM.SceneNameACStrings;
                tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
            }
        }
        void OnEditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
        {
            if (this.Columns[this.CurrentCell.ColumnIndex].Name.Equals(s_WBSInstanceKey))
            {
                ComboBox cbb = e.Control as ComboBox;

                //first remove any existing handlers
                cbb.DropDown       -= new EventHandler(OnComboDropDown);
                cbb.DropDownClosed -= new EventHandler(OnComboDropDownClosed);

                //add new handlers
                cbb.DropDown       += new EventHandler(OnComboDropDown);
                cbb.DropDownClosed += new EventHandler(OnComboDropDownClosed);
            }
        }
Exemplo n.º 23
0
        private void dataProdukDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if ((dataProdukDataGridView.CurrentCell.OwningColumn.Name == "HARGA_ECER" || dataProdukDataGridView.CurrentCell.OwningColumn.Name == "HARGA_PARTAI" || dataProdukDataGridView.CurrentCell.OwningColumn.Name == "HARGA_GROSIR" ||
                dataProdukDataGridView.CurrentCell.OwningColumn.Name == "LIMIT_STOK" || dataProdukDataGridView.CurrentCell.OwningColumn.Name == "KODE_RAK" || dataProdukDataGridView.CurrentCell.OwningColumn.Name == "NOMOR_RAK")
                    && e.Control is TextBox)
            {
                TextBox textBox = e.Control as TextBox;
                textBox.TextChanged += TextBox_TextChanged;

                if (dataProdukDataGridView.CurrentCell.OwningColumn.Name == "KODE_RAK")
                {
                    textBox.CharacterCasing = CharacterCasing.Upper;
                }
            }
            
        }
Exemplo n.º 24
0
        private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (this.dataGridView1.CurrentCell.ColumnIndex == this.DataType.Index)
            {
                //limit this dropdown to just the valid data types for this measure
                BindingSource bindingSource = this.dataGridView1.DataSource as BindingSource;
                MeasureGroupHealthCheckPlugin.MeasureHealthCheckResult item = bindingSource.Current as MeasureGroupHealthCheckPlugin.MeasureHealthCheckResult;
                DataGridViewComboBoxEditingControl comboBox = e.Control as DataGridViewComboBoxEditingControl;
                comboBox.DataSource = item.PossibleDataTypes;
                comboBox.SelectedValue = item.DataType;

                //not necessary to capture this event and commit a change before they leave the cell because we decided not to change cell colors or anything
                //comboBox.SelectionChangeCommitted -= this.comboBox_SelectionChangeCommitted;
                //comboBox.SelectionChangeCommitted += this.comboBox_SelectionChangeCommitted;
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Aggiungere la chiamata a questo metodo in _EditingControlShowing del DataGridView interessato
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void GestioneNumericPad(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            // dataGrid.Columns[dataGrid.CurrentCell.ColumnIndex].Type;

            TextBox innerTextBox;
            if (e.Control is TextBox)
            {
                innerTextBox = e.Control as TextBox;
                // innerTextBox.KeyDown -= new KeyEventHandler(innerTextBox_KeyDown);
                // innerTextBox.KeyDown += new KeyEventHandler(innerTextBox_KeyDown);

                // Succede che si aggancia 2 volte l'evento e poi si duplica il carattere
                innerTextBox.KeyPress -= new KeyPressEventHandler(innerTextBox_KeyPress);
                innerTextBox.KeyPress += new KeyPressEventHandler(innerTextBox_KeyPress);
            }
        }
Exemplo n.º 26
0
 private void dgv_tmp_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     //if (e.Control is DataGridViewComboBoxEditingControl)
     //{
     //    #region ComboBox列
     //    //检测列
     //    DataGridView dgv = (DataGridView)sender;
     //    if ((dgv.CurrentCell.OwningColumn.HeaderText == "发票种类")
     //        )
     //    {
     //        //取得可以编辑被表示的控件
     //        DataGridViewComboBoxEditingControl cb = (DataGridViewComboBoxEditingControl)e.Control;
     //        cb.DropDownStyle = ComboBoxStyle.DropDown;
     //    }
     //    #endregion
     //}
 }
Exemplo n.º 27
0
        private void dataGridView1_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
        {
            //I need to know that the combobox control selection has changed and let the
            //data grid know of the changes event thought this control sitll under edit mode
            ComboBox combo = e.Control as ComboBox;

            if (combo != null)
            {
                // Remove an existing event-handler, if present, to avoid
                // adding multiple handlers when the editing control is reused.
                combo.SelectedIndexChanged -=
                    new EventHandler(ComboBox_SelectedIndexChanged);

                // Add the event handler.
                combo.SelectedIndexChanged +=
                    new EventHandler(ComboBox_SelectedIndexChanged);
            }
        }
Exemplo n.º 28
0
 public void FormatoCeldaGrid(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e, int columnIndex, EntidadNegocio.Enumerados.EnumTipos.TipoFormato caracter)
 {
     try
     {
         DataGridView _dataGridView = sender as DataGridView;
         if (_dataGridView.Name == "DataGridView")
         {
             _grid        = ((DataGridView)sender);
             _columnIndex = columnIndex;
             _caracter    = caracter;
             TextBox validar = ((TextBox)e.Control);
             validar.KeyPress += new KeyPressEventHandler(KeypessCeldaEnGrid);
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 29
0
        private void dgvPOItems_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (dgvPOItems.CurrentCell.ColumnIndex == 0)
            {
                ComboBox cb = e.Control as ComboBox;
                if (cb != null)
                {
                    cb.SelectedIndexChanged -= new EventHandler(cb_SelectedIndexChanged);
                    cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
                }
            }
            if (dgvPOItems.CurrentCell.ColumnIndex == 2)
            {
                TextBox tb = e.Control as TextBox;
                if (tb != null)
                {
                    tb.TextChanged -= new EventHandler(tb_TextChanged);
                    tb.TextChanged += new EventHandler(tb_TextChanged);
                }

            }
        }
Exemplo n.º 30
0
 void DataGridViewEx_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     DataGridViewCell template = CurrentCell.OwningColumn.CellTemplate;
     if (template == null)
         return;
     IDataGridViewAutoCompleteSource source = template as IDataGridViewAutoCompleteSource;
     TextBox box = e.Control as TextBox;
     if (box != null)
     {
         if (source == null)
         {
             box.AutoCompleteMode = AutoCompleteMode.None;
             box.AutoCompleteSource = AutoCompleteSource.None;
             box.AutoCompleteCustomSource = null;
         }
         else
         {
             box.AutoCompleteMode = AutoCompleteMode.Append;
             box.AutoCompleteSource = AutoCompleteSource.CustomSource;
             box.AutoCompleteCustomSource = source.AutoCompleteSource;
         }
     }
 }
Exemplo n.º 31
0
        //public static void AddAutoCompleteToDataGridView(List<DataGridView> _dataGridViewList, TabControl tabControl1, DataGridViewEditingControlShowingEventArgs e, AutoCompleteStringCollection _diveNo, AutoCompleteStringCollection _diveNoReadOnly, AutoCompleteStringCollection _diveName, AutoCompleteStringCollection _diveNameReadOnly, GroupBox groupBox)
        //{
        //    Thread t = new Thread(() => _AddAutoCompleteToDataGridView(_dataGridViewList, tabControl1, e, _diveNo, _diveNameReadOnly, _diveName, _diveNameReadOnly, groupBox));
        //    t.Start();
        //}
        /// <summary>
        /// Laddar in AutoComplete listorna till textboxarna i TabControlern
        /// </summary>
        /// <param name="_dataGridViewList"></param>
        /// <param name="tabControl1"></param>
        /// <param name="e"></param>
        /// <param name="_diveNo"></param>
        /// <param name="_diveNoReadOnly"></param>
        /// <param name="_diveName"></param>
        /// <param name="_diveNameReadOnly"></param>
        /// <param name="groupBox"></param>
        public static void AddAutoCompleteToDataGridView(List<DataGridView> _dataGridViewList, TabControl tabControl1, DataGridViewEditingControlShowingEventArgs e, AutoCompleteStringCollection _diveNo, AutoCompleteStringCollection _diveNoReadOnly, AutoCompleteStringCollection _diveName, AutoCompleteStringCollection _diveNameReadOnly, GroupBox groupBox)
        {
            int tabControlName = Int32.Parse(tabControl1.SelectedTab.Name);
            DataGridView currentDataGridView = _dataGridViewList[tabControlName];

            int columnIndex = currentDataGridView.CurrentCell.ColumnIndex;
            string headerText = currentDataGridView.Columns[columnIndex].HeaderText;
            //int rad = currentDataGridView.CurrentCell.RowIndex;

            //string position = currentDataGridView.Rows[rad].Cells[0].Value.ToString();

            UpdateAutoCompleteList(currentDataGridView, tabControl1, _diveNo, _diveNoReadOnly, _diveName, _diveNameReadOnly, groupBox);

            if (headerText.Equals("Kod"))
            {
                TextBox tb = e.Control as TextBox;

                if (tb != null)
                {
                    tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                    tb.AutoCompleteCustomSource = _diveNo;
                    tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
                }
            }

            if (headerText.Equals("Namn"))
            {
                TextBox tb = e.Control as TextBox;

                if (tb != null)
                {
                    tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                    tb.AutoCompleteCustomSource = _diveName;
                    tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
                }
            }
        }
 /// <summary>
 /// Allows to enter numbers only in cells of grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvServiceVoucher_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     try
     {
         DataGridViewTextBoxEditingControl dgvtxtAmount = e.Control as DataGridViewTextBoxEditingControl;
         if (dgvtxtAmount != null)
         {
             dgvtxtAmount.KeyPress += dgvtxtAmount_KeyPress;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 50 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 33
0
 private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     if (e.Control is ComboBox)
     {
         ComboBox combobox = e.Control as ComboBox;
         combobox.DropDownStyle = ComboBoxStyle.DropDown;
     }
 }
Exemplo n.º 34
0
 private void dgReturnItems_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     e.Control.KeyPress += new KeyPressEventHandler(dgReturnItems_KeyPress);
 }
Exemplo n.º 35
0
 void runGrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     eCtl = e.Control;
     eCtl.TextChanged -= new EventHandler(eCtl_TextChanged);
     eCtl.KeyPress -= new KeyPressEventHandler(eCtl_KeyPress);
     eCtl.TextChanged += new EventHandler(eCtl_TextChanged);
     eCtl.KeyPress += new KeyPressEventHandler(eCtl_KeyPress);
 }
 /// <summary>
 /// Checking the gridview's keypress event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProduct_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     try
     {
         DataGridViewTextBoxEditingControl TextBoxControl = e.Control as DataGridViewTextBoxEditingControl;
         if (TextBoxControl != null)
         {
             if (dgvProduct.CurrentCell != null && dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName")
             {
                 TextBoxControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                 TextBoxControl.AutoCompleteSource = AutoCompleteSource.CustomSource;
                 TextBoxControl.AutoCompleteCustomSource = ProductNames;
             }
             else if (dgvProduct.CurrentCell != null && dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode")
             {
                 TextBoxControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                 TextBoxControl.AutoCompleteSource = AutoCompleteSource.CustomSource;
                 TextBoxControl.AutoCompleteCustomSource = ProductCodes;
             }
             else
             {
                 TextBoxControl.KeyPress += TextBoxCellEditControlKeyPress;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN62:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 37
0
 /// <summary>
 /// Calling the keypress event here
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvAdditionalCost_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 {
     TextBoxControl = e.Control as DataGridViewTextBoxEditingControl;
     try
     {
         if (TextBoxControl != null)
         {
             if (dgvAdditionalCost.CurrentCell.ColumnIndex == dgvAdditionalCost.Columns["dgvtxtAdditionalCostAmount"].Index)
             {
                 TextBoxControl.KeyPress += keypressevent;
             }
             else
             {
                 TextBoxControl.KeyPress += keypresseventforOther;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:94" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 38
0
        /// <summary>
        /// grid EditingControlShowing event To handle the keypress event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvProduction_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            TextBoxControl = e.Control as DataGridViewTextBoxEditingControl;
            try
            {
                if (TextBoxControl != null)
                {

                    if (dgvProduction.CurrentCell != null && dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name == "dgvtxtProductionProductName")
                    {
                        TextBoxControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                        TextBoxControl.AutoCompleteSource = AutoCompleteSource.CustomSource;
                        TextBoxControl.AutoCompleteCustomSource = ProductNames;

                    }
                    if (dgvProduction.CurrentCell != null && dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name == "dgvtxtProductionProductCode")
                    {
                        TextBoxControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                        TextBoxControl.AutoCompleteSource = AutoCompleteSource.CustomSource;
                        TextBoxControl.AutoCompleteCustomSource = ProductCodes;

                    }
                    if (dgvProduction.CurrentCell != null && dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name != "dgvtxtProductionProductCode" && dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name != "dgvtxtProductionProductName")
                    {
                        DataGridViewTextBoxEditingControl editControl = (DataGridViewTextBoxEditingControl)dgvProduction.EditingControl;
                        editControl.AutoCompleteMode = AutoCompleteMode.None;
                    }
                    if (dgvProduction.CurrentCell.ColumnIndex == dgvProduction.Columns["dgvtxtProductionQty"].Index)
                    {
                        TextBoxControl.KeyPress += keypressevent;
                    }
                    else if (dgvProduction.CurrentCell.ColumnIndex == dgvProduction.Columns["dgvtxtProductionRate"].Index)
                    {
                        TextBoxControl.KeyPress += keypressevent;
                    }
                    else if (dgvProduction.CurrentCell.ColumnIndex == dgvProduction.Columns["dgvtxtProductionAmount"].Index)
                    {
                        TextBoxControl.KeyPress += keypressevent;
                    }
                    else
                    {
                        TextBoxControl.KeyPress += keypresseventforOther;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SJ:70" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void Grd_Task_And_Client_Wise_TAT_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
 {
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 5)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 6)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 7)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 8)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 9)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 10)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 11)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 12)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 13)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
     if ((int)(((System.Windows.Forms.DataGridView)(sender)).CurrentCell.ColumnIndex) == 14)
     {
         e.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextboxNumeric_KeyPress);
     }
 }
Exemplo n.º 40
0
 private void DataGridView1_EditingControlShowing(object sender, System.Windows.Forms.DataGridViewEditingControlShowingEventArgs e)
 {
     editigncntrl = (ComponentFactory.Krypton.Toolkit.KryptonDataGridViewTextBoxEditingControl)e.Control;
 }