Solved

Validating Decimal Input From A Datagrid

Posted on 2006-06-09
2
472 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
Comment Utility
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
Comment Utility
what is the version of .net?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

11 Experts available now in Live!

Get 1:1 Help Now