|
-
Nov 16th, 2012, 09:46 AM
#1
Thread Starter
Addicted Member
remove duplicate from multi line textbox
i have had inuff searching wasted 30 min and cant find what am looking for so annoyed can anybody help
-
Nov 16th, 2012, 10:02 AM
#2
Re: remove duplicate from multi line textbox
30 minutes, eh? 
Anyways, can you at least explain in details what you want to accomplish? Thanks.
-
Nov 16th, 2012, 10:06 AM
#3
Re: remove duplicate from multi line textbox
Well, as a mutliline textbox is really one STRING, you can use split or instr to seach in that string, word for word. If you want to remove a 'line', that could prove difficult. Another method (albiet a long one), you could also go word for word in that string, put them each in a listbox, go through the listbox and remove dupes, and then replace your textbox with your new string. But split is probably your best answer to remove duplicate 'words'/strings in the textbox.
-
Nov 17th, 2012, 07:16 PM
#4
Re: remove duplicate from multi line textbox
first of all you need to know which words to find... and we need to know what is it for and maybe what kind of words you will be looking for and why is it your looking for these words
for example if you remove the words in a chat you could be doing something bad because if someone write
Hey how are you today? I hope today will be a good day! Do you need some help with your code?
...... so in here you have the word you 3 times (yes only 2, but one would also be "your", if you do use instr() )
...... and the word day
...... and the word a (if looking with split(text, " "))
anyways see how it is not good... you will need a list (kind of what sam said) and once you have that list you can look for the words
unless it is for something that is not suppose to have duplicate words like when receiving data make sure you dont get 3 times the username or 3 times the same file etc...
-
Nov 18th, 2012, 01:13 AM
#5
Re: remove duplicate from multi line textbox
@bogaa: You really do need to slow down and think about your questions before you post them. You give us very little information or detail of exactly what the circumstances are, how the 'duplicate' got there in the first place, what exactly you mean by 'duplicate' and what should happen to the remaining text (eg having removed the 'duplicate' should the whole TextBox then be re-formatted?).
I could read your question literally:
Code:
Dim lngPos As Long
Dim lngStart As Long
lngStart = 1
Do
lngPos = InStr(lngStart, txt.Text, "duplicate")
If lngPos > 0 Then
txt.SelStart = lngPos - 1
txt.SelLength = 9
txt.SelText = vbNullString
End If
lngStart = lngPos + 1
Loop Until lngStart > Len(txt.Text) Or lngPos = 0
which does exactly what you've asked - but I doubt if that's what you want. How do you expect us to be able to help if you don't supply enough information ?
I suspect that there are some members here who take a look at your Posts, come to the conclusion that there's not enough information and just skip them, when, perhaps they could have helped if you'd given more details.
Remember that you're much closer to your code then we are.
Last edited by Doogle; Nov 18th, 2012 at 01:22 AM.
-
Nov 18th, 2012, 10:27 AM
#6
Thread Starter
Addicted Member
Re: remove duplicate from multi line textbox
sorry doogle nxt time il add more info thanks
-
Nov 18th, 2012, 10:40 AM
#7
Re: remove duplicate from multi line textbox
So, would you like to tell us more about the problem you're having with duplicates?
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
|