Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Validating Decimal Input From A Datagrid

Posted on 2006-06-09
2
Medium Priority
?
479 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

972 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