Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
5970 | Jul 27,2003 03:30 PM UTC | Jul 30,2003 11:12 AM UTC | WinForms | 7 |
![]() |
Tags: GridControl |
//C# private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; string s = cc.Renderer.ControlText; GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex]; if(s.Length > 0) { try { if(style.CellValueType == typeof(double)) { double d = double.Parse(s); } //else check other types.... } catch { e.Cancel = true; cc.ErrorMessage = "Your Error Message"; } } } 'VB.NET Private Sub GridDataBoundGrid1_CurrentCellValidating(ByVal sender As Object, ByVal e As CancelEventArgs) Handles GridDataBoundGrid1.CurrentCellValidating Dim cc As GridCurrentCell = Me.GridDataBoundGrid1.CurrentCell Dim s As String = cc.Renderer.ControlText Try Dim d As Double = double.Parse(s) Catch 'bad value e.Cancel = True cc.ErrorMessage = "MyMessage" EndTry End Sub
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.