Thanks really a lot Rick, you helped me as I'm a novice programmer.
If you can guide me to a link (if it exists)so that I can learn more details
about the usage of these RTF codes (like \super, \b etc..) because the msdn
library cd's do not supply clear info for such beginner...
Have a nice day!
--
Cengiz Ulku
cengizu@bluewin.ch
----------------------------------
"Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
news:ddqdnT1G8NsUyqqiU-KYgw@comcast.com...[color=blue]
> Alright, try this code....
>
> With RichTextBox1
> CurrentPosition = .SelStart
> .SelStart = 0
> .SelLength = 1
> Do While InStr(.SelRTF, "\super") = 0
> Position = .Find(Text1.Text, .SelStart + 1)
> If Position = -1 Then
> .SelStart = CurrentPosition
> Exit Do
> End If
> Loop
> .SetFocus
> End With
>
> The above **only** finds the first occurrence if there are multiple
> occurrences of the number in your TextBox. You didn't say whether there
> could be multiple occurrences of the same number in superscript and[/color]
whether[color=blue]
> you needed to find all of them. I'm going to sleep in a couple of minutes,
> so I can't look for a solution of that right now. If you need that, post
> back saying so.
>
> Rick - MVP
>
>
>
> "Cengiz Ulku" <cengizu@bluewin.ch> wrote in message
> news:3f374949_4@news.bluewin.ch...[color=green]
> > Thank you Rick!
> >
> > My Rtf file is not written within my program's RTB control, the file is
> > written by Word and saved as rtf. As an abnormal char I have only these
> > superscripts which needs to be found and highlighted when the user looks[/color]
> for[color=green]
> > it.
> >
> > Here is what the text looks like:
> > ^1 Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
> > ^2 sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna[/color][/color]
aliguam[color=blue][color=green]
> > erat volutpat. Ut wisis enim ad minim veniam
> > ^3 quis nostrud exerci tution ullam corper suscipit lobortis nisi ut[/color]
> aliquip[color=green]
> > ex ea commodo consequat. Duis te feugi facilisi. Duis autem dolor
> > etc...
> >
> > Thanks a lot in advance!
> > Cengiz Ulku
> >
cengizu@bluewin.ch
> >
> >
> > "Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
> > news:f-SdnfLICZ7MHKuiXTWJkg@comcast.com...[color=darkred]
> > > > I've already posted a question similar but will need some precisions[/color][/color]
> and[color=green][color=darkred]
> > > > help.
> > > >
> > > > I have a rtf file displayed within a RTB control. Above it, I have a[/color]
> > text[color=darkred]
> > > > box control with a scroller which helps me to increase/decrease[/color][/color]
> numbers[color=green][color=darkred]
> > > > inside it by clicking. (There should be a shorter name for this
> > > control!!!)
> > > >
> > > > What I want is: Whenever I click the increase the number button, the
> > > > concerned number within my rtf file is selected. The numbers to be
> > > selected
> > > > are fonts with superscripts not normal fonts. So When I increase the
> > > numbers
> > > > from 1 to whatever the program will select the superscripted number[/color][/color]
> but[color=green][color=darkred]
> > > not
> > > > any other number which may exist in normal form.
> > >
> > > If you are using the SelCharOffset property to establish your[/color][/color]
> superscript,[color=green][color=darkred]
> > > then I would think code something like this will find the first[/color][/color]
> occurrence[color=green][color=darkred]
> > > of a character specified in Text1 that has its SelCharOffset property[/color][/color]
> set[color=green]
> > to[color=darkred]
> > > anything other than zero. You can use this as a base in case you have[/color][/color][/color]
to[color=blue][color=green]
> > do[color=darkred]
> > > multiple consecutive selections or whatever.
> > >
> > > Dim Position As Long
> > > Dim CurrentPosition As Long
> > > With RichTextBox1
> > > CurrentPosition = .SelStart
> > > .SelStart = 0
> > > .SelLength = 1
> > > Do While .SelCharOffset = 0
> > > Position = .Find(Text1.Text, .SelStart + 1)
> > > If Position = -1 Then
> > > .SelStart = CurrentPosition
> > > Exit Do
> > > End If
> > > Loop
> > > .SetFocus
> > > End With
> > >
> > > Rick - MVP
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]