show selected text in a textbox

D

DraguVaso

Hi,

I have a big multiline Textbox with scrollbars. I want to be able to look
for a substring in the textbox, and select it. So far no problem.

But: when the selected piece of text in the textbox isn't visible, I want it
to be visible! So I need to let the scrollbars scroll until the selected
text is visible or something like that. Is there a function liek that in
VB.NET? Or how can I accomplish this?

Thanks a lot,

Pieter
 
H

Herfried K. Wagner [MVP]

* "DraguVaso said:
I have a big multiline Textbox with scrollbars. I want to be able to look
for a substring in the textbox, and select it. So far no problem.

But: when the selected piece of text in the textbox isn't visible, I want it
to be visible! So I need to let the scrollbars scroll until the selected
text is visible or something like that. Is there a function liek that in
VB.NET? Or how can I accomplish this?

Set the focus to the control and call its 'ScrollToCaret' method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top