Επεξεργασία

Κοινή χρήση μέσω


DateTimePicker.ValueChanged Event

Definition

Occurs when the Value property changes.

public:
 event EventHandler ^ ValueChanged;
public event EventHandler ValueChanged;
public event EventHandler? ValueChanged;
member this.ValueChanged : EventHandler 
Public Custom Event ValueChanged As EventHandler 

Event Type

Examples

The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the ValueChanged event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type DateTimePicker named DateTimePicker1. Then ensure that the event handler is associated with the ValueChanged event.

private void DateTimePicker1_ValueChanged(Object sender, EventArgs e) {

   MessageBox.Show("You are in the DateTimePicker.ValueChanged event.");
}
Private Sub DateTimePicker1_ValueChanged(sender as Object, e as EventArgs) _ 
     Handles DateTimePicker1.ValueChanged

   MessageBox.Show("You are in the DateTimePicker.ValueChanged event.")

End Sub

Remarks

User input is validated before this event is raised. This event is not raised when the entered date is earlier than MinDateTime or later than MaxDateTime.

For more information about handling events, see Handling and Raising Events.

Applies to

See also