.NET framework bug

G

Guest

I found in a windows form application, if you have a validating event attached to a textbox, that event is not reliable.

For example, in a MDI application, you created a toolbar in the MDI container. And one of the MDI child has a textbox with validating event.

Then you input some invalid text into the textbox, then click a button of the toolbar.

Sure, you will get validating event invoked and you have to come back to the textbox. Ok now, you press <TAB>, magic happens, you can leave this field, and there is no validating event being called again.

The pattern is, if your form is in MDI, and you trigger validating by moving focus to a control out of your form but in same MDI container. Then validating event will be missed when next time it is supposed to happen.

I believe this is a serious problem and security hole of .NET framework.

Is there anybody has experience to have workaround?
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Is it any wonder. Varification mechanism in .NET doesn't work as exepcted in
many cases; it is buggy. I hope they will fix it for the next version.

--

Stoitcho Goutsev (100) [C# MVP]


John Mao said:
I found in a windows form application, if you have a validating event
attached to a textbox, that event is not reliable.
For example, in a MDI application, you created a toolbar in the MDI
container. And one of the MDI child has a textbox with validating event.
Then you input some invalid text into the textbox, then click a button of the toolbar.

Sure, you will get validating event invoked and you have to come back to
magic happens said:
The pattern is, if your form is in MDI, and you trigger validating by
moving focus to a control out of your form but in same MDI container. Then
validating event will be missed when next time it is supposed to happen.
 
G

Guest

Not only doesn't the validating event fire, but if the text box is bound to a
dataset, the column changed event doesn't fire.

I workaround the issue by capturing the form activated event, changing focus
to another control (a toolbar), then returning focus to the textbox. With
that workaround, the validating event always seems to fire when the user tabs
out of the textbox.


Stoitcho Goutsev (100) said:
Is it any wonder. Varification mechanism in .NET doesn't work as exepcted in
many cases; it is buggy. I hope they will fix it for the next version.

--

Stoitcho Goutsev (100) [C# MVP]


John Mao said:
I found in a windows form application, if you have a validating event
attached to a textbox, that event is not reliable.
For example, in a MDI application, you created a toolbar in the MDI
container. And one of the MDI child has a textbox with validating event.
Then you input some invalid text into the textbox, then click a button of the toolbar.

Sure, you will get validating event invoked and you have to come back to
magic happens said:
The pattern is, if your form is in MDI, and you trigger validating by
moving focus to a control out of your form but in same MDI container. Then
validating event will be missed when next time it is supposed to happen.
I believe this is a serious problem and security hole of .NET framework.

Is there anybody has experience to have workaround?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top