Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to add a TextChanged event to a StatusBarPanel but that event does not exist.
How can I determine when the text is changed?

VB
For Each pan As System.Windows.Forms.StatusBarPanel In SB.Panels
     AddHandler pan.TextChanged, AddressOf PanelTextChanged
Next pan


Any help is very welcome!
Posted

you can use databinding to bind text in your StatusBar with text in textbox.Than add handler to TextChanged event in textbox
 
Share this answer
 
This event is indeed not available in StatusBarPanel. I think the reason is: it is not needed. In edit boxes, there are two way of modification of text: by the user and programmatically. As the only way to write to StatusBarPanel is programmatical, who needs this event?

If you have nothing else to do, you can always create a derived class using StatusBarPanel as a base class and add this event. You derived panels will be used in you UI in exact same way as original StatusBarPanel class.

You certainly need coherency if you write some status text in two places, to avoid repeating yourself (http://en.wikipedia.org/wiki/Don't_repeat_yourself[^]). But in this case, do just the opposite: create some text property on some outer context, such as you form. In setter of this property code the side effect of the setting: writing to your (regular) status bar panel and some other effect which should be kept in sync with status panel. This approach is much easier and more flexible at the same time.

—SA
 
Share this answer
 
I still need some help with this, as I can not get the handler to a textbox. Is it possible to help me and post some code on how to achieve this? I also posted here: How to use databinding to bind text in my StatusBar with text in textbox[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900