I have a textbox with a paragraph of information. There are certain words in the paragraph that i want the user to be able to click on, and when clicked,开发者_JAVA百科 a different textbox is populated with more information.
I know that you can have the event for the whole textbox, but that isn't want i want. I only want to call that event when certain words within the box are clicked.
Sorry, but I don't think you're going to be able to do it like that. The text in a textbox is a singular value type string, there are no objects for "words" or "letters" which would be necessary to raise such an event.
Your best bet will be to subscribe to the textbox keypressed event and parse the string each time a new letter is added. It may not be beautiful, but it's not a huge overhead.
精彩评论