Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Validating Decimal Input From A Datagrid

Posted on 2006-06-09
2
Medium Priority
?
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

722 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