Questions tagged [validating-event]

16 questions
21
votes
1 answer

Why is my validating event not firing in C#?

I have a form that is dynamically created. It is a winForms application. This form is just a menu and a series of textboxes and labels. For the sake of this example, you can ignore the labels. My problem is: When I edit stuff in the textboxes, then…
Jerry
  • 4,507
  • 9
  • 50
  • 79
3
votes
2 answers

Cancelling TabPage.Validating locks my UI

I have a TabControl with multiple TabPages which each contain multiple controls. When a user moves away from my tab using a button, I want to validate that the controls on that tab were modified correctly. Specifically, I want to check that they…
Freefall
  • 73
  • 5
2
votes
2 answers

C# Validating event: test for blank textbox and number validation?

So I'm trying to create a validating event that makes sure a textbox isn't empty and that the number entered doesn't exceed 2000. I've posted what I have but every time I run it I get a message that the exception wasn't handled because the "kwh =…
rachelabr
  • 53
  • 1
  • 3
1
vote
1 answer

C# TabStop in Validating not working

if i have these lines in my TextBox_Validating the tabstop on the TextBox will fired twice: ((TextBox)sender).AutoCompleteCustomSource.AddRange(new string[] { ((TextBox)sender).Text, }); But if remove the lines above the Tabstop works fine and…
1
vote
1 answer

Same event handler for two events which requires different signature

I have a method that I want to invoke both on the TextChanged and Validating events. The problem is that the e parameter of TextChanged is of type EventArgs while the e parameter of Validating is of type CancelEventArgs. I could obviously do…
Michael Haddad
  • 4,085
  • 7
  • 42
  • 82
1
vote
2 answers

Skipping validation for closing the form from the controlbox

I have a simple form with a textbox and I want to make the user to enter some data in the textbox before closing or skipping this control,but when I handle the validating event I 'm only able to close the form by putting a Cancel Button with…
user1831490
0
votes
0 answers

Adding values to datagridcomboboxcell during validation + hitting Enter = Null Reference

I have a datagridview displaying user information. The datasource is a dataset table, and I want the values of this dataset to change dynamically when the use edits the values in the datagridview. To do this I have harnessed the datagridview's…
user1723280
  • 11
  • 1
  • 2
0
votes
3 answers

Validating Text input with val()

I try to validate the Input in my website because of Cross-Site-Scripting-Attacks!
Gazale_m
  • 41
  • 6
0
votes
1 answer

validating control in function of destination

I have a TextBox that should contain a file name. It's mandatory for the program to work so I've put: Private Sub tbScanFilter_Validating(sender As Object, e As CancelEventArgs) Handles tbScanFilter.Validating If tbScanFilter.Text.Length = 0…
0
votes
2 answers

How to avoid duplication of validation events Winforms

I am creating a project which will consist of three forms, one parent form which will be a decider on which form to load. Due to the two child forms being slightly similar, a lot of validation is the same. I have my methods for validation which are…
0
votes
1 answer

Validation using Validating event and ErrorProvider - Show Error Summary

How to show Messagebox "Data is invalid" when there is errors left in my WinForms. Tried something like but it does not work. if (errorprovider1 == !null) { MessageBox.Show("Data is invalid"); } Maybe i have to use bool for this solution. My full…
0
votes
1 answer

Tabbing off control bypasses validation .NET

So, I have a User Control which is just a TextBox with special formatting rules (there are reasons why I'm not just using a MaskedTextBox...y'know...the sensible solution). Anyhow, when the user inputs invalid data, they can't click off using the…
Greg
  • 1
0
votes
1 answer

Validating Event Not Firing

I'm having real trouble getting the validating event to fire. I have created a very simple windows form to demonstrate the problem. The form contains two textboxes and I'd expect the validating event to fire when the tab key is pressed in the first…
0
votes
1 answer

how to validate the Textbox allows only first character Capital latter in c#.net?

I have a task, my textbox accepts only first character capital lettr and remaing characters normal.
user1858718
  • 137
  • 2
  • 3
  • 12
0
votes
2 answers

C# TextBox.Validating Cancel Event for ASPX

I'm trying to convert code from a WinForm to a WinApp, but I know very little of aspx, and nothing of javascript. I have programmatically created a textbox that will be given text. The text is then passed through a validation method like…
user1015106
  • 45
  • 1
  • 5
1
2