Solved

Validating Decimal Input From A Datagrid

Posted on 2006-06-09
2
473 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

943 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now