BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if( this.gridControl1[cc.RowIndex, cc.ColIndex].CellValueType == typeof(double)) { string s = cc.Renderer.ControlText; try { double d = double.Parse(s); } catch { cc.ErrorMessage = "bad value"; e.Cancel = true; } } }3) On your cancel button, try setting its CausesValidation property to false. 4) At the grid level, you could handle CurrrentCellKeyPress.
private void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if(this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "NumericUpDown") { e.Handled = true; } }Currently, you can save CSV and TSV files. Future releases will support XLS and XML.
//save text private void button3_Click(object sender, System.EventArgs e) { this.gridControl1.Model.TextDataExchange.ExportTabDelim = ","; string outPut; int nRows, nCols; GridRangeInfoList rangeInfoList = new GridRangeInfoList(); rangeInfoList.Add(GridRangeInfo.Cells(1, 1, this.gridControl1.RowCount, this.gridControl1.ColCount)); bool b = this.gridControl1.Model.TextDataExchange.CopyTextToBuffer(out outPut, rangeInfoList, out nRows, out nCols); if(b) { StreamWriter writer = new StreamWriter("test.csv"); writer.Write(outPut); writer.Close(); } }
> private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e) > { > GridCurrentCell cc = this.gridControl1.CurrentCell; > if( this.gridControl1[cc.RowIndex, cc.ColIndex].CellValueType == typeof(double)) > { > string s = cc.Renderer.ControlText; > try > { > double d = double.Parse(s); > } > catch > { > cc.ErrorMessage = "bad value"; > e.Cancel = true; > } > } > } >> > 3) On your cancel button, try setting its CausesValidation property to false. > > 4) At the grid level, you could handle CurrrentCellKeyPress. >
> private void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e) > { > GridCurrentCell cc = this.gridControl1.CurrentCell; > if(this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "NumericUpDown") > { > e.Handled = true; > } > } >> > > Currently, you can save CSV and TSV files. Future releases will support XLS and XML. > >
> //save text > private void button3_Click(object sender, System.EventArgs e) > { > this.gridControl1.Model.TextDataExchange.ExportTabDelim = ","; > > string outPut; > int nRows, nCols; > GridRangeInfoList rangeInfoList = new GridRangeInfoList(); > rangeInfoList.Add(GridRangeInfo.Cells(1, 1, this.gridControl1.RowCount, this.gridControl1.ColCount)); > bool b = this.gridControl1.Model.TextDataExchange.CopyTextToBuffer(out outPut, rangeInfoList, out nRows, out nCols); > > if(b) > { > StreamWriter writer = new StreamWriter("test.csv"); > writer.Write(outPut); > writer.Close(); > } > } >