Textbox Value to Double

raven1124

New Member
Hello Guys,

Seeking for your assistance with converting the text inside the Textbox to Double

Here's the sample code
Code:
Private Sub Test()
Dim MNLActualPerf As Double

txtMNLActualPerf.Text = "11.15%"

'Error mismatch 13
MNLActualPerf  = (CDbl(VarianceForm.txtMNLActualPerf))

'Error mismatch 13
'Tends to work if textbox has no decimal point
MNLActualPerf  = (Val(VarianceForm.txtMNLActualPerf))
 
Try this:

Code:
Dim MNLActualPerf As Double

txtMNLActualPerf.Text = "11.15%"


If InStr(Me.txtMNLActualPerf, "%") > 0 Then
    MNLActualPerf = CDbl(Replace(Me.txtMNLActualPerf, "%", "") / 100)
Else
    MNLActualPerf = CDbl(Me.txtMNLActualPerf)
End If
 

Some videos you may like

This Week's Hot Topics

Top