Solved

vb.Net Remove percent formatting textbox value

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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

691 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