|
-
Mar 21st, 2006, 11:33 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Removing Specific text in a listbox
ok say i have 3 things loaded in a listbox it looks like this
hi!
hi1!
hi2!
how can i remove the "!" but i would also like for it to be an option so like if i put $ in a textbox it will remove all of "$" I would appreciate the help thank you!
-
Mar 21st, 2006, 11:51 PM
#2
Re: Removing Specific text in a listbox
You may have to loop through the contents of the listbox then use the REPLACE function...
-
Mar 22nd, 2006, 12:04 AM
#3
Frenzied Member
Re: Removing Specific text in a listbox
i think this requires a nested for loop
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Mar 22nd, 2006, 12:47 AM
#4
Thread Starter
Addicted Member
Re: Removing Specific text in a listbox
well i have very little experience in vb so could you guess give me some examples?
-
Mar 22nd, 2006, 12:59 AM
#5
Re: Removing Specific text in a listbox
Something like...
VB Code:
Private Sub Command1_Click()
RemoveCharacter "!"
End Sub
Private Sub RemoveCharacter(ByVal strChar As String)
Dim a As Long
For a = 0 To List1.ListCount - 1
List1.List(a) = Replace$(List1.List(a), strChar, "")
Next
End Sub
-
Mar 22nd, 2006, 01:07 AM
#6
Thread Starter
Addicted Member
Re: Removing Specific text in a listbox
how could i make it so whatever i put in a text box it removes?
-
Mar 22nd, 2006, 01:22 AM
#7
Frenzied Member
Re: Removing Specific text in a listbox
call dee-u's function in the change event of your textbox
VB Code:
Private Sub Text1_Change()
RemoveCharacter(text1.Text)
End Sub
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Mar 22nd, 2006, 01:25 AM
#8
Thread Starter
Addicted Member
Re: Removing Specific text in a listbox
thank you all! Appreciated the help
-
Mar 22nd, 2006, 02:30 AM
#9
Re: [RESOLVED] Removing Specific text in a listbox
Glad to be of help...
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
|