Solved

vb.Net Remove percent formatting textbox value

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem!!! 8 33
FTP file download using c# 3 22
C# LINQ ForEach() question 6 18
Powershell File Sort 8 24
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

808 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