If you use ToolStrip on a form that has data binding usage, you need to be careful. Clicking any item on a ToolStrip control doesn’t remove your cursor from any control on the form. For example, you edit a textbox on the form and directly click save item on ToolStrip, you will find that your cursor stays in the textbox the whole way. Now the problem is, since the cursor is never moved out of the textbox, the textbox “thought” that it itself is in edit and the data binding underlying will not be triggered. If the underlying data binding is not triggered, you may not be able to save the latest change if you purely rely on data binding to update underlying business object or whatever.
When I came across this problem, I just happen to have a button always sitting on my form. Whenever I click something on the ToolStrip control, I manually set the button to get the focus. In that way, whatever controls that holding data that need to be updated will be updated via data binding mechanism. This is just a quick & easy solution but it works. Whatever method suits you, you need to be careful that ToolStrip control operation doesn’t crab the focus from the main form and thus data binding may not work (in the right timing) for you!
Until next time, happy coding!
There’s good info here. I did a search on the topic and found most people will agree with your blog. Keep up the good work mate!
By: Tnelson on September 30, 2009
at 10:50 pm
I don’t know If I said it already but …Hey good stuff…keep up the good work!
I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,)
A definite great read..Jim Bean
By: JimmyBean on October 1, 2009
at 9:17 am
what a great site and informative posts, I will add a backlink and bookmark your site. Keep up the good work!
By: RobD on October 6, 2009
at 9:21 pm
Generally I do not post on blogs, but I would like to say that this post really forced me to do so, Excellent post!
By: Bill Bartmann on October 9, 2009
at 3:47 pm