PDA

Click to See Complete Forum and Search --> : Losing the decimal


hbarker
Nov 23rd, 1999, 08:08 PM
I am writing to a file and I have come across
a problem. I have a text box of which the user can enter 1.2 or .4599 or .098 or 23.67 and when it writes to the file I need it to write as 12 or 4599 or 098 or 2367. Any way I can do this? (multilplication will not work because the decimal can be in any given place).

mcleran
Nov 23rd, 1999, 08:23 PM
Use the Replace string manipulation function in VB. Start a Std Exe project, add 2 text boxes (txtEntered, txtReplaced) and a command button (cmdGo). Here's a one-liner to demonstrate. Add this code to your form:

Option Explicit

Private Sub cmdGo_Click()
txtReplaced = Replace(txtEntered, ".", "")
End Sub


[This message has been edited by mcleran (edited 11-24-1999).]

[This message has been edited by mcleran (edited 11-24-1999).]