-
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 :wave:
-
Re: Removing all the txt after the $ sign (From textbox)
Just call the following function like this:
Text1.Text = RemoveDollars(Text1.Text)
VB Code:
Public Function RemoveDollars(ByVal s As String) As String
Dim n As Long, nCount As Long
Dim nPos As Long
Dim sLines() As String
sLines = Split(s, vbCrLf)
s = ""
nCount = UBound(sLines)
For n = 0 To nCount
nPos = Instr(sLines(n), "$")
If nPos Then
s = s & Left$(sLines(n), nPos - 1) & vbCrLf
Else
s = s & sLines(n)
End If
Next
'return the string without the last CrLf pair
RemoveDollars = Left$(s, Len(s) - 2)
End Function
-
Re: Removing all the txt after the $ sign (From textbox)
VB Code:
Private Sub Form_Load()
Dim SpltCash() As String
Dim cat As String
Dim i As Integer
SpltCash() = Split("Jake has $300.00 Payday April 3", "$")
For i = 0 To UBound(SpltCash)
If i <> 0 Then
SpltCash(i) = vbNullString
End If
cat = cat & SpltCash(i)
Next i
MsgBox cat
End Sub
heres the easiest way, if you want another way just ask
-
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
-
Re: Removing all the txt after the $ sign (From textbox)
Thank you for that suggestion also |2em!x!!
-
Re: Removing all the txt after the $ sign (From textbox)
yeah sure :wave:
did you mean me by rhino, or did he delete his post?
-
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.
-
Re: Removing all the txt after the $ sign (From textbox)
k, i thougth he thought i was rhino :D
-
Re: Removing all the txt after the $ sign (From textbox)
LOL ... it happens ... ;)
-
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"?
-
Re: Removing all the txt after the $ sign (From textbox)
lisp is a word.
VB Code:
1. A speech defect or mannerism characterized by mispronunciation of the sounds (s) and (z) as (th) and (th).
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.
-
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.
-
Re: Removing all the txt after the $ sign (From textbox)
lmao..thats so true+funny
-
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.
-
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 ;)).
-
Re: Removing all the txt after the $ sign (From textbox)
Yea, but you presented as a joke ...
-
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. :(
-
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 ... :rolleyes:
-
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.
-
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. :sick:
-
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.
-
Re: Removing all the txt after the $ sign (From textbox)
...Nothing like an intense debate on code.
-
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! :thumb:
Stilekid007 :wave: