Looking for the function to convert 8.5% to .085
It's tough being an unhandled exception... ___________ VB.NET 2008 VB.NET 2010 ORACLE 11g CRYSTAL 11
Text = "8.5%" without the quotes?
My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer << "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein
strip the % off, convert to a decimal, and divide by 100. -tg
* I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.* * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.* * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft * * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
Code: Dim s As String = "8.5%" Dim d As Decimal If s.Contains("%") Then s = s.Replace("%", "") End If If Decimal.TryParse(s.Trim, d) Then 'good number, convert percent to decimal d = d / 100 End If
Dim s As String = "8.5%" Dim d As Decimal If s.Contains("%") Then s = s.Replace("%", "") End If If Decimal.TryParse(s.Trim, d) Then 'good number, convert percent to decimal d = d / 100 End If
Forum Rules