473,799 Members | 3,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capture clicked word in RTF control in 2010

228 New Member
Hi,

I have a rich text box control in my form. Much like Concise Oxford Dictionary, when user clicks on any word, I need to capture it and process it. The click event don't help and I can't seem to figure it out.

Any tips?
Aug 13 '11 #1
3 1831
kadghar
1,295 Recognized Expert Top Contributor
Remember that when your textbox is not selected, when you clic on it you'll only select the control. Once it's selected, when you clic on some part of the text, you'll change the selection.

In this case, check where the selection is and (perhaps using INSTR and INSTRREV for blank spaces) select the entire word, then look for it. The clic method should work fine then.
Aug 16 '11 #2
samvb
228 New Member
Thanks for your help. Actually, selection and clicking is not part of the option.I want something like Oxford Concise Dictionary's feature. If I fail, i will go your way.
Aug 16 '11 #3
R MacDonald
24 New Member
Hello, samvb,

The MouseClick event provides a MouseEventArgs argument (e) which in turn provides properties e.x and e.y that indicate the location where the click event took place. You could pass this information to the RichTextBox's GetCharIndexFro mPosition method to get the index of the character where the user clicked. Using this as a starting point, then search both backwards and forwards through the Text to find the boundaries of the word clicked by the user.

Cheers,
Randy
Aug 21 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
57399
by: gokul | last post by:
Hi, Iam a newbie to dotnet and I experience problems in using the Browser control in VB .net. Though Iam able to use it with its basic features, I need to customise it. http://www.codeproject.com/books/0764549146_8.asp The above link shows where what I want is achived in C#, but I need t oa cjhive the same in VB .net. Someone help and guidance would be much appreciated.
0
1161
by: Klein | last post by:
I have an application which can load ms word documents and save them. The application has a main form with a file menu, an edit menu and a tool bar. I have a DocumentControl(usercontrol) defined which handles loading the word document into itself. The flow of events are as follows: Main Form -> New -> Creates an instance of DocumentControl -> Loads Word document into DocumentControl (by passing itself as a window handle). The new...
6
8804
by: Ron Vecchi | last post by:
I need to allow my control when it is visible to capture the mouse and not let any other control react to mouse events until control is hidden. Similar to ContextMenu Any Suggestions -- Ron Vecchi
1
1143
by: Dean Slindee | last post by:
Is there a control that can be placed on a form to display a *.doc file and preserve the text and images intact? Read only would be OK, no updating of the document needed. Thanks, Dean Slindee
0
1577
by: Jon Paal | last post by:
To produce 1 dynamic chart, I add a control to my aspx page positioned in a placeholder. I need to have more than one chart and need to capture the chart control output so it can be complemented with table tags. The chart control, renders an image by adding an html tag to the page like: "<img src='webchart_image_processor.aspx?id=f64fef28-5adb-4103-8ac6-aaf10b70d1a2' border='0'>" How can I extract this tag information from the...
7
2030
by: Mateusz Rajca | last post by:
Hello, I am writing a text editor in C#. Is there any good and free text control similar to Word? Matt
1
5086
by: MCM | last post by:
How do I capture an Image (Bitmap) of one of my controls (in a Windows Form App) and place it on the clipboard in C#? Thanks, - M
13
1514
by: =?Utf-8?B?RG9uYWxkIEZpc2hlcg==?= | last post by:
Hello. I'm trying to capture a controls value: a dropdown box with two selections (either "Red" or "Blue") keeps returning the value "Red" even if "Blue" is selected?
0
1881
by: Andy B | last post by:
I have a wizard I am using to step a user through creating some documents that will eventually be saved as xml at the end of the wizard. What controls would I need to use to do the following? I have on step 1 of the wizard 2 textBoxes called WordTextBox and DefinitionTextBox. I have an add button that will add the word/definition pairs to a c# dictionary object contained inside a class. When the user fills in these 2 text boxes, the...
0
9688
marktang
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...
0
9544
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10238
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,...
0
10030
tracyyun
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...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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();...
0
5467
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...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
bsmnconsultancy
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...

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.