/// <summary> /// Fires off the 'EditingControlTextChanged' event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> ////private void objEditingcontrol_TextChanged(object sender, EventArgs e) ////{ //// try //// { //// this.GetNodeForRow(this.CurrentCell.RowIndex).NodeEditingMode = NodeEditMode.Updated; //// insidetextchanged = true; //// string s = objEditingcontrol.Text; //// if (selectionStart == -1) //// { //// selectionStart = objEditingcontrol.SelectionStart; //// selectionLength = objEditingcontrol.SelectionLength; //// } //// //this.CommitEdit(DataGridViewDataErrorContexts.Commit| DataGridViewDataErrorContexts.CurrentCellChange); //// //this.dvSource.Table.AcceptChanges(); //// //this.Update(); //// //this.Refresh(); //// int col = this.CurrentCell.ColumnIndex; //// col = this.get_actual_colum_index(col); //// //int start = 0; //// int start = s.Length; //// int test = 0; //// //int m_intCheckLength = 0; //// if (CheckNumericColumn(col, ref test)) //// { //// //entrycount++; //// //** //// string op = this.strInCommaFormat(s, col, ref start); //// //string[] arr = op.Split(','); //// string[] arr = op.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); //// int i = arr.Length - 1; //// //string[] arr2 = editingcontrol.Text.Split(','); //// string[] arr2 = objEditingcontrol.Text.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); //// int j = arr2.Length - 1; //// if (i != j) //// noOfCommas = 1; //// //* /** //// //this.EditingControl.Text = op; //// //decimal s1 = Convert.ToDecimal(s); //// this.objEditingcontrol.Text = op.ToString();//**************** //// //this.CurrentCell.Value = s; //// //this.editingcontrol.EditingControlFormattedValue = s1; //// // this.editingcontrol.EditingControlDataGridView.CurrentCell.Value = s1; //// //this.CurrentCell.Value = s1; //// // this.editingcontrol.SelectionStart = s.Length; //// } //// else //// { //// //entrycount++; //// this.objEditingcontrol.Text = s; //// this.CurrentCell.Value = s; //// // this.editingcontrol.SelectionStart = start; //// } //// //} //// insidetextchanged = false; //// DataGridViewEditingControlTextChanged _textChanged = new DataGridViewEditingControlTextChanged(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex, this.CurrentCell.EditedFormattedValue.ToString());// this.CurrentCell.Value.ToString()); //// if (EditingControlTextChanged != null) //// { //// EditingControlTextChanged(null, _textChanged); //// } //// } //// catch //// { //// MessageBox.Show("error"); //// } ////} private void objEditingcontrol_TextChanged(object sender, EventArgs e) { objEditingcontrol.TextChanged -= new EventHandler(objEditingcontrol_TextChanged); try { this.GetNodeForRow(this.CurrentCell.RowIndex).NodeEditingMode = NodeEditMode.Updated; insidetextchanged = true; string s = objEditingcontrol.Text; if (selectionStart == -1) { selectionStart = objEditingcontrol.SelectionStart; selectionLength = objEditingcontrol.SelectionLength; } //this.CommitEdit(DataGridViewDataErrorContexts.Commit| DataGridViewDataErrorContexts.CurrentCellChange); //this.dvSource.Table.AcceptChanges(); //this.Update(); //this.Refresh(); DataGridViewEditingControlTextChanged _textChanged = new DataGridViewEditingControlTextChanged(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex, this.CurrentCell.EditedFormattedValue.ToString());// this.CurrentCell.Value.ToString()); if (EditingControlTextChanged != null) { EditingControlTextChanged(this, _textChanged); } if (!blStopEventPropagation) { int col = this.CurrentCell.ColumnIndex; col = this.get_actual_colum_index(col); //int start = 0; int start = s.Length; int test = 0; //int m_intCheckLength = 0; if (CheckNumericColumn(col, ref test)) { //entrycount++; //** string op = this.strInCommaFormat(s, col, ref start); //string[] arr = op.Split(','); string[] arr = op.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int i = arr.Length - 1; //string[] arr2 = editingcontrol.Text.Split(','); string[] arr2 = objEditingcontrol.Text.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int j = arr2.Length - 1; if (i != j) noOfCommas = 1; //* /** //this.EditingControl.Text = op; //decimal s1 = Convert.ToDecimal(s); this.objEditingcontrol.Text = op.ToString();//**************** //this.CurrentCell.Value = s; //this.editingcontrol.EditingControlFormattedValue = s1; // this.editingcontrol.EditingControlDataGridView.CurrentCell.Value = s1; //this.CurrentCell.Value = s1; // this.editingcontrol.SelectionStart = s.Length; } else { //entrycount++; this.objEditingcontrol.Text = s; this.CurrentCell.Value = s; // this.editingcontrol.SelectionStart = start; } //} insidetextchanged = false; } else { int col = this.CurrentCell.ColumnIndex; col = this.get_actual_colum_index(col); int start = dblPrevVal.ToString().Length; int test = 0; string op = this.strInCommaFormat(dblPrevVal.ToString(), col, ref start); string[] arr = op.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int i = arr.Length - 1; string[] arr2 = objEditingcontrol.Text.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int j = arr2.Length - 1; if (i != j) noOfCommas = 1; this.objEditingcontrol.Text = op.ToString(); blStopEventPropagation = false; //this.objEditingcontrol.Text = dblPrevVal.ToString(); } //DataGridViewEditingControlTextChanged _textChanged = new DataGridViewEditingControlTextChanged(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex, this.CurrentCell.EditedFormattedValue.ToString());// this.CurrentCell.Value.ToString()); //if (EditingControlTextChanged != null) //{ // EditingControlTextChanged(null, _textChanged); //} } catch { MessageBox.Show("error"); } finally { objEditingcontrol.TextChanged += new EventHandler(objEditingcontrol_TextChanged); } }
void editingcontrol_TextChanged(object sender, EventArgs e) { try { //if (entrycount < 1) //{ insidetextchanged = true; string s = editingcontrol.Text; if (selectionStart == -1) { selectionStart = editingcontrol.SelectionStart; selectionLength = editingcontrol.SelectionLength; } //this.CommitEdit(DataGridViewDataErrorContexts.Commit| DataGridViewDataErrorContexts.CurrentCellChange); //this.dvSource.Table.AcceptChanges(); //this.Update(); //this.Refresh(); int col = this.CurrentCell.ColumnIndex; col = this.get_actual_colum_index(col); //int start = 0; int start = s.Length; int test = 0; //int m_intCheckLength = 0; if (CheckNumericColumn(col, ref test)) { //entrycount++; //** string op = this.strInCommaFormat(s, col, ref start); //string[] arr = op.Split(','); string[] arr = op.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int i = arr.Length - 1; //string[] arr2 = editingcontrol.Text.Split(','); string[] arr2 = editingcontrol.Text.Split(Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator)); int j = arr2.Length - 1; if (i != j) noOfCommas = 1; //* /** //this.EditingControl.Text = op; //decimal s1 = Convert.ToDecimal(s); this.editingcontrol.Text = s.ToString(); //this.CurrentCell.Value = s; //this.editingcontrol.EditingControlFormattedValue = s1; // this.editingcontrol.EditingControlDataGridView.CurrentCell.Value = s1; //this.CurrentCell.Value = s1; // this.editingcontrol.SelectionStart = s.Length; } else { //entrycount++; this.editingcontrol.Text = s; this.CurrentCell.Value = s; // this.editingcontrol.SelectionStart = start; } //} insidetextchanged = false; DataGridViewEditingControlTextChanged _textChanged = new DataGridViewEditingControlTextChanged(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex, this.editingcontrol.Text.ToString()); if (EditingControlTextChanged != null) { EditingControlTextChanged(null, _textChanged); } if (_AllowRowStatusSettings) SetRowStatus(sender); } catch { } //return; }