Take the 2-minute tour ×

Iam working on a touch screen windows form that has many checkboxes, textboxes, listboxes, date dropdown pickers etc. Depending on user action a status message is displayed at the bottom. For eg., Your profile saved successfully, From and to date cannot be same, Please select a valid ... etc

What is an elegant way to clear the status message on ANY touch.

if (statusLabel.text != string.empty )
    statusLabel.text = string.empty)  

Meaning if any checkbox is checked, any text is input in a textbox, any listbox or combo is selected...then I want to clear the status label. This way the last status message does not "stick" to confuse the user. I am poking around to see if I can override some event at the form level in one place that will do this.


thx Saravanan and Pedery for your suggestions. They do not solve my problem. I just discovered Reactive extensions and posting a related question which may help me. Left mouse button click detect on winform using Reactive extensions IObservable on events

share|improve this question
add comment

3 Answers

  1. Try to find an event in the statusbar itself like text changed or content changed etc. Override it to clear the content of itself.

  2. You may write code to clear the status bar content on the change event of the control's container.

Its your choice.

share|improve this answer
add comment

You can put the message in the controls' Tag property and use a single common event to add them all up.

If you wanna be more orderly, you can subclass the checkbox with a custom property the same way.

share|improve this answer
add comment

This was the solution to my problem

protected override void WndProc(ref Message msg)
        case WM_LBUTTONDOWN:
        //Do something here
        //add other cases if needed


    // call the base class WndProc for default message handling
    base.WndProc(ref msg);
share|improve this answer
add comment

Your Answer


