Solved

convert to decimal or double

Posted on 2013-01-12
4
250 Views
Last Modified: 2013-04-20
Dear experts
Dim amt As Double = Double.Parse(Me.Amount.Text.ToString()) is giving error

Input string was not in a correct format.

please support
0
Comment
Question by:bmkdubai
[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
4 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 38771490
use tryparse instead:

Dim amt As Double

if(Double.TryParse(Me.Amount.Text.ToString(), out amt))
'parsing success
else
'parsing failed
end if

Open in new window

0
 
LVL 42

Expert Comment

by:sedgwick
ID: 38818505
Debug your code check what is the value u try to parse.
It might be invalid number.
U can also check for null or empty before parsing using string.IsNullOrEmpty
0
 

Author Comment

by:bmkdubai
ID: 39097200
I've requested that this question be deleted for the following reason:

answers are not clear
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 discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
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…

630 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