Yes, it would be character by character.
Compare The Dog is out
with The Dog iXXs out
the entire phrase (The Dog iXXs out) wout appear in the textbox with both
XX's highlighted in, preferably, red text or some other method of making
those characters stand out. It would be a character by character comparison.
Each character that is different in the second phrase would be highlighted.
Compare The Dog is out
with The DXog is oXuXt
The phrase would appear in the textbox as
The DXog is oXuXt
with all of the X's highlighted in red making it very clear to the user that
these characters are what is different from the first phrase.
> You need to define 'difference' more fully. What would you highlight here --
>
[quoted text clipped - 26 lines]
> >
> > Any help is greatly appreciated.
Sorry, you've misunderstood a little. If you do character-by-character
comparison, then using
> Compare The Dog is out
> with The Dog iXXs out
*all* the characters from the first X onwards are different (not just the
Xs). Character-by-character means comparing the characters in position n in
the two strings: OK if the same, highlight if not. If you don't want 's out'
highlighted, you need extra logic to determine that positions 10-14 in
string 1 match positions 11-15 in string 2.
> Yes, it would be character by character.
>
[quoted text clipped - 53 lines]
>> >
>> > Any help is greatly appreciated.
Frankbelly - 10 Nov 2006 03:39 GMT
Ah, yes I see. Thank you. You have definitely put me in the right
direction. I will begin experimenting with code which determines how not to
highlight the other letters that match regardless of their position.
I did have one other related question though...Can you have different
colored text within one TextBox on a userform. i.e., the X's in the phrase
would be red while the remaining text is black in the same textbox?
I am doing a comparison between the values of two textboxes on a userform
compare textbox.value1
with textbox.value2
> Sorry, you've misunderstood a little. If you do character-by-character
> comparison, then using
[quoted text clipped - 65 lines]
> >> >
> >> > Any help is greatly appreciated.
Jay Freedman - 10 Nov 2006 03:43 GMT
And that's only the case where characters have been added to the
original string. Then you need to consider cases where characters have
been removed, or where some have been added and others have been
removed at the same time. And how about transpositions, either of
adjacent characters or of ones separated by one or more characters?
Once you get a decent definition of the rules, then you'll find that
you can't change the font colors for only some of the text in a
regular text box of a userform -- there's only one ForeColor property
for the entire text box. To do what you want, you'll need a Rich Text
control. There isn't one in the set of controls that come with Office,
so you'll have to find one somewhere else. Unfortunately, you can't
use the one that came with VB 6.0, because it's a security risk and is
therefore disabled (http://support.microsoft.com/?kbid=838010). You
can try this one:
http://www.mvps.org/emorcillo/download/vb6/ctl_riched.msi
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>Sorry, you've misunderstood a little. If you do character-by-character
>comparison, then using
[quoted text clipped - 65 lines]
>>> >
>>> > Any help is greatly appreciated.
Frankbelly - 10 Nov 2006 04:04 GMT
Great!
thank you both so much (Jezebel and Jay)
I really appreciate your help.
> And that's only the case where characters have been added to the
> original string. Then you need to consider cases where characters have
[quoted text clipped - 89 lines]
> >>> >
> >>> > Any help is greatly appreciated.