Results 1 to 5 of 5

Thread: String Manipulation question...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2003
    Posts
    27

    String Manipulation question...

    Hey again... i have a little question.
    I have a textbox that has returns at the end of the text, the ammount depending on the number of times the text has been saved.... there is a problem in the save code i'm using because it saves an extra return at the bottom of the text, causing the returns to build up. I need soem kind of string manipulation loop like trim() but instead of spaces, it deletes the returns at the end. I'm still learning VB, so i hope you guys have patience... what would be the most proficient way in doing this? Thanks
    -wat

  2. #2
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    WHy not fix the save code instead of trying to patch it? in other words make it stop adding the unwanted returns instead of removing them afterwards.


    Let me see your save code
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2003
    Posts
    27
    Open App.path + "\current.txt" For Output As #1
    Print #1, Form1.txtdemo.text
    Close #1
    Else
    End If


    I'm using that as an autosave, and returns are building up... i'm pretty sure its the save code, but its really basic... heres the load code i'm using

    Dim filelength$
    Dim var1$
    If FileExists(App.path + "\current.txt") Then
    Open App.path + "\current.txt" For Input As #1
    filelength = LOF(1)
    var1 = Input(filelength, #1)
    Form1.txtdemo.text = var1
    Close #1
    -wat

  4. #4
    Addicted Member Flip's Avatar
    Join Date
    Jun 2002
    Location
    Burke, VA
    Posts
    247
    instead of

    VB Code:
    1. SaveFile Text1.Text
    put
    VB Code:
    1. SaveFile Mid(Text1.Text, 1, Len(Text1.Text)-1)
    or i think a return might be two spaces so you might need this:
    VB Code:
    1. SaveFile Mid(Text1.Text, 1, Len(Text1.Text)-2)

    would that work?
    The "company" website My homepage: nerisoft.com
    scars heal but glory is forever

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2003
    Posts
    27
    Yep! Thanks a lot flip, i used that and edited the load code and it now works! I'm pretty sure it was your input though, thanks a lot!
    -wat

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