Use the Control.CausesValidation property, is a Boolean that obtains or sets a value that indicates whether the control causes validation of all controls that require validation when they receive the focus. In this case, the conflicting events are Form.FormClosing, Button.Click and KeyPress that prevents you from seselccione the next control with Tab, since I was testing with your code and effectively, the event Click of your cancel button is never executed (I tried with a MessageBox), nor the event% co_of%. Well, the problem here is that the property Cancel of CancelEventArgs when set to true, will always block any event that occurs after the Validating event. But if I do it from the button1 this.close() it does not close the window when I press the button. In the event Form1_FormClosing of the form I did what e.cancel = false said, which works only when the X of the form is pressed and the form closes. If I remove the e.cancel = true it does not show me the ErrorProvider When the form has that error sign, I can not change the cursor, let alone close the window. Why can not I give Tab or change the cursor while ErrorProvider is active? Why can not I close the window when ErrorProvider is active? If the TextBox that I'm validating this empty shows the ErrorProvider, and the cursor stays in that TextBox empty waiting to be validated again. The problem I have when the ErrorProvider is activated so to speak. Private void btnCerrar(object sender, EventArgs e) Private void textBox1_Validated(object sender, EventArgs e) valida cuando el TextBox pierde el foco y quita el ErrorProvider si no está vacío Private void valida(object sender, CancelEventArgs e, TextBox tb, ErrorProvider error) Método que recibe un textbox y un Error provider para validar si el textBox esta vacio. Valida(sender, e, textBox1, errorProvider1) Private void textBox1_Validating(object sender, CancelEventArgs e) Llama al método valida para decidir si el TextBox está vacío. I'm doing validations in C # with ErrorProvider. Handling Mouse Events in Visual Basic.Adding Tables and Columns to the Windows Forms DataGrid Control in VB.NET.Changing Displayed Data at Run Time in the DataGrid Control in VB.NET.Master-Details Lists with the DataGrid Control in VB.NET.Deleting Columns in the DataGrid Control in VB.NET.Formatting the Windows Forms DataGrid Control in VB.NET.Keyboard Shortcuts for the Windows Forms DataGrid Control in VB.NET.Responding to Clicks in the Windows Forms DataGrid Control in VB.NET.Windows Forms DataGrid Control in VB.NET.DateTimePicker Control (Windows Forms) in VB.NET.Windows Forms FolderBrowserDialog Component in VB.NET.Windows Forms FontDialog Component in VB.NET.HScrollBar and VScrollBar Controls in VB.NET.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |