473,473 Members | 4,208 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Determine if decimal value too large

How can I determine if a value the user entered is too large for a decimal
datatype?

for instance, if the user enters 12345678901234567890123456789

and my variable
Dim inches as Decimal = cDec(textbox1.text)

Causes an exception. How can I capture this before it causes an exception.
Sep 30 '08 #1
1 1014
On Sep 30, 11:15*pm, <testerwrote:
How can I determine if a value the user entered is too large for a decimal
datatype?

for instance, if the user enters 12345678901234567890123456789

and my variable
* * Dim inches as Decimal = cDec(textbox1.text)

Causes an exception. *How can I capture this before it causes an exception.
Use Try..Catch block

Try
Dim inches As Decimal = CDec(x)
....
Catch
End Try
Sep 30 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
18
by: Brad | last post by:
I have a problem in that I need to change a large decimal value into its hex equivalent. The largest decimal value I need to represent as hex is 25516777215. The problem here is that this number...
3
by: Golan | last post by:
Hello, I have a hexa file which I need to convert to decimal. I use memcpy into variables (char for one octet, short for 2 octets and int for 4 octets) and then print the value into the file by...
10
by: Paul Sullivan | last post by:
decimal d; d = 1.1M OR d= (decimal) 1.1 Discussioon
3
by: AdamM | last post by:
Hi all, What function lets me check a text string and determine if that string is really a int, float, double, etc. just formatted as a string? Thanks in advance! Adam
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Is there a way to determine if a numeric value contains a decimal? how to do this? If IsNumeric(txt1.Text) then ... so now I know that txt1.Text is a numeric value. How can I tell if it is a...
26
by: kerravon | last post by:
The following C program: int main(void) { int x = -2147483648; return (0); } Produces the following warning:
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.