This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D.
Even when I change the property Causes Validation of the form to false, its no effect. Validating Event and Sticky Forms the Validating event also fires when you close a form. I hope that this problem is not a bug of the software, and that you can find the solution. If you set the Cancel property of the Cancel Event Args object to true inside this event, it will cancel the close operation as well. (Quoted from: Num=6) The closing operation can be conducted in one of three ways: Either 1) Clicking a cancel button, 2) Window close button or 3) Escape key. Solution: We now show how to stop the validation from occuring in case of canceling the operation. We refer to each of the possible operations specified above. Cancel Button: Simply set the Causes Validation of the cancel button to false . Thus, every control that is assigned to a validating event will not be called. Window close button: Need to override the wnd Proc method, check the window msg and if the last equals WN_CLOSE, and define it somewhere (it is not automatically defined) , set the Causes Validation of the active control to false. 今天偶在 "C#经典入门"上看了一个关于Text Box的例子，发现winforms中对控件的有效性验证比Web难多了，主要是因为它涉及到了自定义事件，而web应用程序的开发对控件的验证，VS工具提供了相应的验证控件。另外对Tag属性也有了一定的认识，当你使用这个属性时，会有很多意想不到的效果。感觉这个Tag属性，可以当成是一个控件的标签或标志，或者用来作为控件的备注。通过这个程序的学习我对事件也有了更进一步的认识。顺便也把这个程序拿出来给大家分享一下。 界面设计 namespace Text Box Test //实现代码 using System;using System. hope this helps Adding to that response, your code very much look like a event handling code for an server control, in which case it is real good to know how event works in ."we know the sender is a Text Box, so we cast the sender object to that " so in the above sentence.NET EXACTLY, inside out, as event in server controls are very important...an instance of textbox object is passed through a 'delegate' (which ill explain soon) as an instance of object class as it only accept parameter as object class NOT textbox object.SQLite combo Box text Box - C# Printer, : Print_ID (PK) Print_Name Dept Dept .