Results 1 to 23 of 23

Thread: Removing all the txt after the $ sign (From textbox) {RESOLVED}

  1. #1

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Removing all the txt after the $ sign (From textbox) {RESOLVED}

    Hello,

    I have a textbox and in it is text - Example lines of text.

    "Jake has $300.00 Payday April 3
    Jan has $120.00 Payday April 9
    Tim has $234.00 Payday April 24"

    Now there is a whole bunch and what I want a command button to do is delete everything in each line after the $ sign (Including the $ sign delete)

    Anyone who has some code I would appreciate any help!
    Stilekid007
    Last edited by stilekid007; Jun 13th, 2005 at 09:55 PM.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    Just call the following function like this:
    Text1.Text = RemoveDollars(Text1.Text)
    VB Code:
    1. Public Function RemoveDollars(ByVal s As String) As String
    2.     Dim n As Long, nCount As Long
    3.     Dim nPos As Long
    4.     Dim sLines() As String
    5.     sLines = Split(s, vbCrLf)
    6.     s = ""
    7.     nCount = UBound(sLines)
    8.     For n = 0 To nCount
    9.         nPos = Instr(sLines(n), "$")
    10.         If nPos Then
    11.             s = s & Left$(sLines(n), nPos - 1) & vbCrLf
    12.         Else
    13.             s = s & sLines(n)
    14.         End If
    15.     Next
    16.     'return the string without the last CrLf pair
    17.     RemoveDollars = Left$(s, Len(s) - 2)
    18. End Function

  3. #3
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Removing all the txt after the $ sign (From textbox)

    VB Code:
    1. Private Sub Form_Load()
    2. Dim SpltCash() As String
    3. Dim cat As String
    4. Dim i As Integer
    5. SpltCash() = Split("Jake has $300.00 Payday April 3", "$")
    6.     For i = 0 To UBound(SpltCash)
    7.     If i <> 0 Then
    8.         SpltCash(i) = vbNullString
    9.     End If
    10.      cat = cat & SpltCash(i)
    11.     Next i
    12.     MsgBox cat
    13. End Sub

    heres the easiest way, if you want another way just ask

  4. #4

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Removing all the txt after the $ sign (From textbox)

    Thank you both of you!
    Joacim's deletes the $ sign and everything after - Rhino yours deletes the whole line that has the $ sign in it. Joacim's works really good!

    THANK YOU SO MUCH!
    Stilekid007

  5. #5

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Removing all the txt after the $ sign (From textbox)

    Thank you for that suggestion also |2em!x!!

  6. #6
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Removing all the txt after the $ sign (From textbox)

    yeah sure

    did you mean me by rhino, or did he delete his post?

  7. #7
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by stilekid007
    ... Rhino yours deletes the whole line that has the $ sign in it. ...
    I misread your question so I deleted my reply ... sorry for the confusion.

  8. #8
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Removing all the txt after the $ sign (From textbox)

    k, i thougth he thought i was rhino

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    LOL ... it happens ...

  10. #10
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by RhinoBull
    I misread your question so I deleted my reply ... sorry for the confusion.
    When we're on the subject of misreading... Isn't it unfair to dyslectic people that it's so hard to spell the words "dyslectic" and "dyslexia"? And why is the a letter "s" in the word "lisp"?

  11. #11
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Removing all the txt after the $ sign (From textbox)

    lisp is a word.

    VB Code:
    1. 1. A speech defect or mannerism characterized by mispronunciation of the sounds (s) and (z) as (th) and (th).
    2.    2. A sound of or like a lisp: “The carpenter ['s]... plane whistles its wild ascending lisp” (Walt Whitman).

    also a computer language, i guess.

  12. #12
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    I know lisp is a word, I just wondered why it contained the letter "s" when:
    Quote Originally Posted by dglienna
    1. A speech defect or mannerism characterized by mispronunciation of the sounds (s) and (z) as (th) and (th).
    I just think it's unfair agains a person that has this speech defect since he/she isn't able to pronounce the word.

  13. #13
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Removing all the txt after the $ sign (From textbox)

    lmao..thats so true+funny

  14. #14
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by Joacim Andersson
    When we're on the subject of misreading... Isn't it unfair to dyslectic people that it's so hard to spell the words "dyslectic" and "dyslexia"? And why is the a letter "s" in the word "lisp"?
    I'm afraid it's NOT funny, Joacim.

  15. #15
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by RhinoBull
    I'm afraid it's NOT funny, Joacim.
    I'm not saying it's funny. I said it was unfair... (But also a bit funny ).

  16. #16
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    Yea, but you presented as a joke ...

  17. #17
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Removing all the txt after the $ sign (From textbox)

    hmmmm. i missed the deleted post. I was just commenting on the word lisp. I didn't even see it in the thread.

  18. #18
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    You didn't miss much - I can asure you - you have many other things (as usual) to take care so let's move on and forget about this one ...

  19. #19
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by RhinoBull
    Yea, but you presented as a joke ...
    That's because I meant it as a joke but I also firmly believe that it is unfair against people that might have these speach and reading disbilities that the words are spelled and pronounced the way they are. I didn't make up those words so don't blaim me will you

    However I didn't mean that you where suffering from them just because you misread the post, that's easily done.

  20. #20
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Removing all the txt after the $ sign (From textbox)

    I just don't understand for the life of me what the heck does all that have to do with me making a little mistake - can you tell me Joacim ???
    Let's forget about this - I never made any post that had to be deleted nor I made any comments about it ... period.

  21. #21
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Removing all the txt after the $ sign (From textbox)

    Quote Originally Posted by RhinoBull
    I just don't understand for the life of me what the heck does all that have to do with me making a little mistake - can you tell me Joacim ???
    The joke I made wasn't aimed against you, as I already stated:
    Quote Originally Posted by Joacim Andersson
    However I didn't mean that you where suffering from them just because you misread the post, that's easily done.
    It was simply the word "misread" that made me think about it. I'm sorry if you got offended Rhino, it wasn't my intention. So yeah, let's forget about it.

  22. #22
    Fanatic Member Nove's Avatar
    Join Date
    Jul 2004
    Posts
    736

    Re: Removing all the txt after the $ sign (From textbox)

    ...Nothing like an intense debate on code.

  23. #23

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Removing all the txt after the $ sign (From textbox)

    Oh I know, its all about the VB! haha! :P Well I do thank you ALL for the code and everything else! TTYL!
    Stilekid007

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