Solved

Validating Decimal Input From A Datagrid

Posted on 2006-06-09
2
475 Views
Last Modified: 2012-06-21
Can someone show a suggestion for validating a decimal field inputted from a datagrid?
I want to be able to check for blank spaces? is there a "if field is nonnumeric" like function in c#?

//* Get data from datagrid
TextBox txtPrice = (TextBox)e.Item.Cells[2].Controls[0];
TextBox txtUnitPrice = (TextBox)e.Item.Cells[3].Controls[0];

decUnitPrice = Convert.ToDecimal(txtUnitPrice.Text.Remove(0, 1));
decPrice = Convert.ToDecimal(txtPrice.Text.Remove(0, 1));

//* need to add some validation controls to check decimal data
0
Comment
Question by:Hojoformo
2 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 500 total points
ID: 16875706
Hi Hojoformo,
----------

there is no direct function like in VB but there is a discussion here with some alternatives
http://dotnet.org.za/deonvs/archive/2004/07/06/2579.aspx

----------
bruintje
share what you know, learn what you don't
0
 
LVL 2

Expert Comment

by:HeidarV
ID: 16876249
what is the version of .net?
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question