• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 883
  • Last Modified:

SelectionChanged event in textbox

Hi Experts,

Is there a way to handle the event of SelectionChanged right inside the control (in a derived class?) such as inside the derived class of MyRichTextBox (which derives from RichTextBox)?

Thanks,
Mike
0
thready
Asked:
thready
  • 3
  • 2
1 Solution
 
isaackhaziCommented:
yes,

Public Event SelectionChanged As RoutedEventHandler
Visual Basic (Usage)
Dim instance As TextBox
Dim handler As RoutedEventHandler

AddHandler instance.SelectionChanged, handler


http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.selectionchanged(VS.95).aspx
from here


0
 
threadyAuthor Commented:
Hi Isaackhazi,

I'm using c# - how would I add the handler with C#?

Thanks,
Mike
0
 
isaackhaziCommented:
public event RoutedEventHandler SelectionChanged
0
 
isaackhaziCommented:
Or just go into your code view.

Select textbox  and in the menu on the right hand side select SelectionChanged event.
0
 
threadyAuthor Commented:
Ahh, I was able to create the event handler in the form and then paste the code into my OnCreateControl within the derived class as needed.  Thanks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now