472,353 Members | 1,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

RichTextBox select text... Need top level select, not internal slc

Hello and thank you for reading this post.

I have a RichTextBox. I need to select text inside for a search feature.
Easy enough... right? Well apparently from the .NET help and everything from
the net, there is nothing describing how to do a top level select that I can
find (ie like how to select or highlight programitcally like a user
highlights text from any window).

Here is my code:

//////////////////////////////////////////
resultPrint.Text = "Found";

WordList_box.SelectionBackColor = Color.Red;

WordList_box.SelectionStart = foundIndex;
WordList_box.SelectionLength = CSWordList_findBox.Text.Length;
//////////////////////////////////////////////

Thats fine, but the user cannot hit CTRL+C and copy that selection. I have
tried many variations but cannot figure out the right way.

Any ideas?

Thank you all,

Rob K
Nov 23 '05 #1
2 2122
> Thats fine, but the user cannot hit CTRL+C and copy that selection. I have
tried many variations but cannot figure out the right way.


The RichTextBox class doesn't implement a user interface - that's up to you.
In your program, you can detect CTRL+C, and call the RichTextBox routine to
copy any selected text to the clipboard. RichTextBox also has routines for
paste, cut, undo, redo, and other things that you can connect to your UI as
appropriate.

Brian.

Nov 23 '05 #2
Ahh... that makes sense... that would explain why you can select the text,
but never physically see the highlighting unless you customize the colors
manually. I will be monitoring keyboard strokes anyways, so CTRL C shouldn't
be too bad. Thank you for replying Brian!

Rob K

"Brian C. Barnes" wrote:
Thats fine, but the user cannot hit CTRL+C and copy that selection. I have
tried many variations but cannot figure out the right way.


The RichTextBox class doesn't implement a user interface - that's up to you.
In your program, you can detect CTRL+C, and call the RichTextBox routine to
copy any selected text to the clipboard. RichTextBox also has routines for
paste, cut, undo, redo, and other things that you can connect to your UI as
appropriate.

Brian.

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin Dew | last post by:
I have a RichTextBox called rtbOutput. I am adding lines of text using the AppendText method. What I want to do is immediately after adding this...
0
by: y2k692hu | last post by:
Hello I am trying to run this and I keep getting a "SystemNullReferenceException: Object reference not set to instance of an object" error. I have...
0
by: John Smith | last post by:
I have text files and I get binary offsets of text portion of these files from VB6 program with RichTextBox. I use VB.Net 2003 and need to select...
2
by: AWesner | last post by:
I am currently working to create a VB program that will do more detailed in-file text search functions than windows has to offer. I have a form with...
9
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the...
1
by: Vivien Parlat | last post by:
Hello, I'm trying to create a small text editor (to be included in another project), and I've created two methods to toggle...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a ...
8
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have created a Control that extends RichTextBox to do syntax-hilighting. My strategy is to have a timer that restarts every time a user types a...
2
by: =?Utf-8?B?TWFyayBDb2xsYXJk?= | last post by:
I'm currently writing an application that has a RichTextBox and a toolbar which includes the following toolbar buttons: - Font - Font Size - Bold...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.