Results 1 to 2 of 2

Thread: Losing the decimal

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    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).

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Longmont,CO
    Posts
    53

    Post

    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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width