From: Andy O'Neill on 29 Apr 2010 15:00 "wannabe geek" <wannabegeek(a)discussions.microsoft.com> wrote in message news:BB411521-3A03-41E6-8C96-43A41EEB5029(a)microsoft.com... > "Jeff Johnson" wrote: > >> "Jeff Johnson" <i.get(a)enough.spam> wrote in message >> news:%23Z5zQU75KHA.3804(a)TK2MSFTNGP05.phx.gbl... >> >> >>I want to know the best way to enforce data types (double, string) in a >> >> DataGridView control. The control would be unbound and >> >> programmatically >> >> populated. TIA. >> > >> > I'd start by looking at the CellEndEdit event. >> >> Actually, it looks like the CellValidating event might be an even better >> choice. >> >> >> . >> > > Is there a way to get .NET to validate data based on specific types or > must > i do that manually and display error messages? > -- > Wannabe Geek Yes. But you would need to bind to something that has the types. You could build a datatable programmatically with all the right field types and set the length of text columns etc Then bind to that. If you put a letter in a numeric column it'll throw an error for you. Not a terribly user friendly error but there may be a way to over-ride it. While since I did winforms.
From: wannabe geek on 29 Apr 2010 16:24 "Andy O'Neill" wrote: > > "wannabe geek" <wannabegeek(a)discussions.microsoft.com> wrote in message > news:BB411521-3A03-41E6-8C96-43A41EEB5029(a)microsoft.com... > > Is there a way to get .NET to validate data based on specific types or > > must > > i do that manually and display error messages? > > -- > > Wannabe Geek > > Yes. > But you would need to bind to something that has the types. > You could build a datatable programmatically with all the right field types > and set the length of text columns etc > Then bind to that. > If you put a letter in a numeric column it'll throw an error for you. > Not a terribly user friendly error but there may be a way to over-ride it. > While since I did winforms. > > . > Thanks. I guess I will attempt to do it manually then. -- Wannabe Geek
First
|
Prev
|
Pages: 1 2 Prev: Calling unmanaged Win32 API from managed code Next: calling unmanaged Windows APi |