Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / February 2005



Tip: Looking for answers? Try searching our database.

richttextbox.find UNICODE text failure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sdowney717@msn.com - 23 Feb 2005 16:36 GMT
Any way to make the .find method of the richtextbox work with unicode
text?
I have everything else working on a unicode project.
I can display unicode text in the proper language, but the .find method
always returns -1. I have the charset and font set properly.
Any ideas will be appreciated.
This is in VB6 with SP6 . The box is listed as sp4 richtx32.ocx.

It appears to find ansi text but even that does not seem to return the
proper position.
Thanks for any help.
Max Christian Pohle - 24 Feb 2005 10:43 GMT
> Any way to make the .find method of the richtextbox work with unicode
> text?
[quoted text clipped - 7 lines]
> proper position.
> Thanks for any help.

Why dont you use instr(richtextbox1.text, ...) ?
sdowney717@msn.com - 24 Feb 2005 19:29 GMT
> > Any way to make the .find method of the richtextbox work with unicode
> > text?
[quoted text clipped - 9 lines]
>
> Why dont you use instr(richtextbox1.text, ...) ?

I have tried this but it does not find the proper positions.
It will find the position but assigning this to selstart of the box
does not work reliably.
Max Christian Pohle - 25 Feb 2005 17:36 GMT
> > > Any way to make the .find method of the richtextbox work with
> unicode
[quoted text clipped - 16 lines]
> It will find the position but assigning this to selstart of the box
> does not work reliably.

Have you also tried the UpTo-method?
Tony Proctor - 25 Feb 2005 20:15 GMT
InStr returns a value from 1:length, whereas the SelStart property runs from
0:length-1. Could it be this difference you're seeing Max?

       Tony Proctor

> > > Any way to make the .find method of the richtextbox work with
> unicode
[quoted text clipped - 16 lines]
> It will find the position but assigning this to selstart of the box
> does not work reliably.
Rick Rothstein - 25 Feb 2005 21:10 GMT
> InStr returns a value from 1:length, whereas the SelStart property
> runs from 0:length-1. Could it be this difference you're seeing Max?

SelStart runs from 0 to Length (not Length - 1). SelStart is the
position along side of characters (not a count of the characters) and,
as such, can be in front of the first character, behind the last
character, or any where in-between.

Rick - MVP
Max Christian Pohle - 26 Feb 2005 00:58 GMT
> InStr returns a value from 1:length, whereas the SelStart property runs from
> 0:length-1. Could it be this difference you're seeing Max?
[quoted text clipped - 21 lines]
> > It will find the position but assigning this to selstart of the box
> > does not work reliably.

Yes. That was the first thing I thought about. But you'd surely figured out
that.
I dont have enough information: Please tell me more about the mistake.
If there is one with the find-method I cannot imagine how it looks.
Have you tried the find-method with all aviable parameters? ...Maybe you
have chosen to search casesensitive and it does not work because of that.
sdowney717@msn.com - 26 Feb 2005 03:25 GMT
I found out you have to leave off the options at the end
And you have to include the length of the rtb for the ending so it goes
like this
 position = rtb.Find(Find.Text, rtb.SelStart, Len(rtb))

If you put any options on it or you leave off the 'end' value, it wont
work properly.
Just use text you want to find, the starting position and the ending
position only.

Another question.
On internationalization with unicode and vb6. I have my system as
English USA and when I test my program, I had to go to control panel,
regional settings, install the language off the XP Cdrom, then I have
to set under the advanced tab the desired language for nonunicode
programs. Restart and the vb app properly displays the appropriate
language chars. And it works great.
I also have to set up a keyboard to copy text back and forth. All this
works.

The question is, on a localized XP installation say in Chinese Taiwan,
Will the VB app display the proper characters? Or not? Or does someone
have to set under the advanced tab some language setting?

What if the XP system is a  Chinese version of XP and the advanced tab
is set for Chinese?

What if the XP system is a chinese version of XP and the advanced tab
is set for english?

Any thoughts on this would be great.
Max Christian Pohle - 26 Feb 2005 13:14 GMT
> I found out you have to leave off the options at the end
> And you have to include the length of the rtb for the ending so it goes
[quoted text clipped - 27 lines]
>
> Any thoughts on this would be great.

I think as long as you're using unicode this should work always, because
unicode is unicode in any language.
Unicode saves every char as 16-bit-value -> It uses more memory. But
therefor unicode is able to save the charset/language for each character
inside, so that you can even use multible languages/charsets in one text.

But all chinese people I know do not work with their languagesetting only,
but also have installed the english keyboardlayout!
sdowney717@msn.com - 27 Feb 2005 19:52 GMT
rtb.find method wont work with russian cyrillac text, just returns -1

But It does work with english and chinese, but russian is out
here is the rtf out of the rtb
My question is, should it work???

?rtb
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset204 MS Sans Serif;}}
\viewkind4\uc1\pard\lang1049\f0\fs20\'d4\'e8\'ed\'ec\'e0\'f0\'ea\'e5\'f2-\'c1\'e8\'e7\'ed\'e5\'f1^(TM)
- \'e4\'e5\'eb\'ee\'e2\'ee\'e9 \'e6\'f3\'f0\'ed\'e0\'eb   the twist in
time \'ca\'f3\'f0\'f1 \'e4\'ed\'ff. \'ce\'f6\'e5\'ed\'ea\'e0
\'e4\'eb\'ff \'e3\'e5\'ed\'e5\'f0\'e0\'eb\'fc\'ed\'ee\'e3\'ee
\'e4\'e8\'f0\'e5\'ea\'f2\'ee\'f0\'e0 \'cf\'e8\'f1\'fc\'ec\'e0
\'e8\'e7\'e4\'e0\'eb\'e5\'ea\'e0. \'d1\'f3\'e4\'fc\'e1\'e0
\'fd\'ec\'e8\'e3\'f0\'e0\'ed\'f2\'e0 - I
"\'c2\'ea\'eb\'e0\'e4\'fb\'e2\'e0\'f2\'fc\'f1\'ff \'e2
\'fd\'eb\'e8\'f2\'f3" - \'ed\'e5 \'f2\'ee\'eb\'fc\'ea\'ee \'e4\'eb\'ff
\'ef\'f0\'ee\'e4\'e0\'e6\'e8
\par }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.