|
-
Jun 13th, 2005, 07:55 PM
#1
Thread Starter
Hyperactive Member
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.
-
Jun 13th, 2005, 08:06 PM
#2
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
-
Jun 13th, 2005, 08:10 PM
#3
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
-
Jun 13th, 2005, 08:12 PM
#4
Thread Starter
Hyperactive Member
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
-
Jun 13th, 2005, 08:13 PM
#5
Thread Starter
Hyperactive Member
Re: Removing all the txt after the $ sign (From textbox)
Thank you for that suggestion also |2em!x!!
-
Jun 13th, 2005, 08:18 PM
#6
Re: Removing all the txt after the $ sign (From textbox)
yeah sure 
did you mean me by rhino, or did he delete his post?
-
Jun 13th, 2005, 08:19 PM
#7
Re: Removing all the txt after the $ sign (From textbox)
 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.
-
Jun 13th, 2005, 08:22 PM
#8
Re: Removing all the txt after the $ sign (From textbox)
k, i thougth he thought i was rhino
-
Jun 13th, 2005, 08:28 PM
#9
Re: Removing all the txt after the $ sign (From textbox)
LOL ... it happens ...
-
Jun 13th, 2005, 08:41 PM
#10
Re: Removing all the txt after the $ sign (From textbox)
 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"?
-
Jun 13th, 2005, 08:56 PM
#11
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.
-
Jun 13th, 2005, 08:59 PM
#12
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:
 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.
-
Jun 13th, 2005, 09:01 PM
#13
Re: Removing all the txt after the $ sign (From textbox)
lmao..thats so true+funny
-
Jun 13th, 2005, 09:03 PM
#14
Re: Removing all the txt after the $ sign (From textbox)
 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.
-
Jun 13th, 2005, 09:04 PM
#15
Re: Removing all the txt after the $ sign (From textbox)
 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 ).
-
Jun 13th, 2005, 09:05 PM
#16
Re: Removing all the txt after the $ sign (From textbox)
Yea, but you presented as a joke ...
-
Jun 13th, 2005, 09:08 PM
#17
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.
-
Jun 13th, 2005, 09:18 PM
#18
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 ...
-
Jun 13th, 2005, 09:18 PM
#19
Re: Removing all the txt after the $ sign (From textbox)
 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.
-
Jun 13th, 2005, 09:22 PM
#20
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.
-
Jun 13th, 2005, 09:30 PM
#21
Re: Removing all the txt after the $ sign (From textbox)
 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:
 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.
-
Jun 13th, 2005, 09:34 PM
#22
Fanatic Member
Re: Removing all the txt after the $ sign (From textbox)
...Nothing like an intense debate on code.
-
Jun 13th, 2005, 09:49 PM
#23
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|