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.Tex t = "Found";
WordList_box.Se lectionBackColo r = Color.Red;
WordList_box.Se lectionStart = foundIndex;
WordList_box.Se lectionLength = CSWordList_find Box.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 2 2212
> 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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 line of text make sure that this line of text
is displayed, effictively scrolling to the last line of the text box all the
time.
Can anyone help as I cannot seem to find a way to do this.
Thanks
|
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 three menu items bold, italic and underline. When i select the text in my RichTextBox, in order to format it bold, italic or underline, I get that error. The debugger points to my Private Sub UpdateMenuItems - the first line of that sub ->where it says "If rtbMain.SelectionFont.Italic = True ".I want...
|
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 and
highlight the text between given offsets. RichTextBox does not highlight the
correct string as it treats new line pair as one character. Is there a way to
highlight the correct string ? How do I translate real binary offsets to
richtextbox offsets ?
To reproduce:
I have placed a text box...
|
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 a
RichTextBox control to display the text that has been found in the files. The
problem is that when a search has been found that is at the very start of the
file and the .select method is used to select just the first portion it ends
up selecting everything in the RichTextBox control...
|
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 "DualFont" and use different fonts.
By the way, how can I print out this content to printer easily?
Thanks!
James
| |
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 bold/italic/underlined
text styles, in order to have the same behaviour as WordPad has, ie :
if I select a text which has bold and non-bold parts, and click
"Italic", after that I have an italic-bold part and an italic-non-bold
one. This is not the case by default, and some programs I use don't
offer to do this.
|
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
RichTextBox as an output window. Some text I want to just add plain (e.g..
rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a
different color or font size. Find() will not work because the text will
vary. I have delimiters on it so I could recognize it with a regular ...
|
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 key so
that it can wait until the user pauses for at least 500 milliseconds, then
perform its work. The hilighting simply goes through a list of keywords,
finding each instance in the RichTextBox, and selecting it in order to change
its color. I figured out how to remember where the cursor is and...
|
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
- Italic
- Underline
I want the toolbox buttons to act the same as the ones in Word. i.e. When
you select text that has different Fonts the Font toolbar button (combo box)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |