Solved

vb.Net Remove percent formatting textbox value

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

20 Experts available now in Live!

Get 1:1 Help Now