Thank you.
> 1) Take a look at the Grid/Samples/Quick Start/TextFormat sample. Rows 11 and 12 there have validation implemented.
>
> 2) You can handle the CurrentCellValidating event and test the value there, cancelling th eevent and setting the message if necessary.
>
> 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();
> }
> }
>