Solved

vb.Net Remove percent formatting textbox value

Posted on 2016-09-20
2
62 Views
Last Modified: 2016-09-26
I have a page that loads percent into textbox
Example
strCommission.Text = String.Format("{0:P}", dR("Commission"))
So... 3.25 % appears on page

What is best way to strip that on save so that if someone types in 3.25
.0325 gets saved
0
Comment
Question by:lrbrister
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 41807637
Try:
            string onPageValue = "3.25 %";
            decimal result = decimal.Parse(onPageValue.TrimEnd(new char[] {' ','%'})) / 100M;
            System.Diagnostics.Debug.WriteLine("Result = " + result);

Open in new window



Prints:

Result = 0.0325
0
 

Author Closing Comment

by:lrbrister
ID: 41815933
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 75
VB/ASP.Net "Value of type 'Date' cannot be converted to 'Integer'" 12 42
orderby list (from Json) 1 30
Convert VB web project to C# 3 38
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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