Solved

vb.Net Remove percent formatting textbox value

Posted on 2016-09-20
2
46 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 29

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now