'Processes data in a text box to read a dollar amount, if any. ' 'post: dollars has been assigned a number if numeric data 'with or without a $ and commas is stored in the text box. 'isValid has been set to True if a numeric value is stored 'in the text box. ' Sub GetDollarAmount(ByVal txtUserData As TextBox, ByRef dollars As Decimal, ByRef isValid As Boolean) Dim testAmount As String isValid = False 'assume nonnumeric data If txtUserData.Text <> Nothing Then testAmount = txtUserData.Text 'data typed testAmount = testAmount.Replace("$", "") 'delete $ testAmount = testAmount.Replace(",", "") 'delete commas If IsNumeric(testAmount) Then 'numeric data dollars = Val(testAmount) isValid = True End If End If End Sub 'Processes data in a text box to read a percentage amount, if any. ' 'post: percent has been assigned a decimal number if numeric 'data with or without a % is stored in the text box. 'isValid has been set to True if a numeric value is stored 'in the text box. ' Sub GetPercentAmount(ByRef txtUserData As TextBox, ByRef percent As Decimal, ByRef isValid As Boolean) Dim testAmount As String isValid = False 'assume nonnumeric data If txtUserData.Text <> Nothing Then testAmount = txtUserData.Text testAmount = testAmount.TrimEnd("%") 'delete % End If If IsNumeric(testAmount) Then 'numeric data If Val(testAmount) > 1 Then 'convert data percent = Val(testAmount) / 100 Else percent = Val(testAmount) End If isValid = True End If End Sub