473,466 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

date time picker and validate event ( is this a bug ? )


I have a problem with the date time picker validate event wich i believe is
a bug
How to reproduce :

throw on a form a date time picker control and a textbox control

select the validating event of the control and add this code

Private Sub DateTimePicker1_Validating(ByVal sender As System.Object, ByVal
e As System.ComponentModel.CancelEventArgs) Handles DateTimePicker1.Validating
TextBox1.Text = Me.DateTimePicker1.Text
End Sub

start the project

change the standard value of the control but only the day or month ( not the
year ) now move away from the control with a tab

The textbox will show a different value as there is currently showed on your
screen by the date time picker
does someone have a good explanation for this ?

regards

Michel


Nov 23 '06 #1
4 4852
For people strugling with the same problem

i just found a workaround
create you own custom datetime picker ( copy and paste this code )

Option Strict On
Option Explicit On
Public Class CustomDateTimePicker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(ByVal e As
System.ComponentModel.CancelEventArgs)
MyBase.Visible = False
MyBase.Visible = True
MyBase.OnValidating(e)
End Sub
End Class

This one behaves as expected , however if you have fast eyes or a slow
machine you might see a blink :-)
I consider the standard behavior as a bug

regards
Michel Posseth [MCP]


"Michel Posseth [MCP]" wrote:
>
I have a problem with the date time picker validate event wich i believe is
a bug
How to reproduce :

throw on a form a date time picker control and a textbox control

select the validating event of the control and add this code

Private Sub DateTimePicker1_Validating(ByVal sender As System.Object, ByVal
e As System.ComponentModel.CancelEventArgs) Handles DateTimePicker1.Validating
TextBox1.Text = Me.DateTimePicker1.Text
End Sub

start the project

change the standard value of the control but only the day or month ( not the
year ) now move away from the control with a tab

The textbox will show a different value as there is currently showed on your
screen by the date time picker
does someone have a good explanation for this ?

regards

Michel

Nov 23 '06 #2
Michel,

Validating a date-time picker?

Is that something they do in Rotterdam?

You can in my idea better validate if the water there is clear enough to
drink.

:-)

Cor

"Michel Posseth [MCP]" <Mi**************@discussions.microsoft.comschre ef
in bericht news:F1**********************************@microsof t.com...
>
I have a problem with the date time picker validate event wich i believe
is
a bug
How to reproduce :

throw on a form a date time picker control and a textbox control

select the validating event of the control and add this code

Private Sub DateTimePicker1_Validating(ByVal sender As System.Object,
ByVal
e As System.ComponentModel.CancelEventArgs) Handles
DateTimePicker1.Validating
TextBox1.Text = Me.DateTimePicker1.Text
End Sub

start the project

change the standard value of the control but only the day or month ( not
the
year ) now move away from the control with a tab

The textbox will show a different value as there is currently showed on
your
screen by the date time picker
does someone have a good explanation for this ?

regards

Michel


Nov 24 '06 #3
Well Cor ,,,
I currently work in a energy company , an we write software that calculates
energy bills .

A bill has to be made in a certain range of a time span

so before we create new entry`s in the database we would like to "validate"
this entered range, however it gets a bit tricky if the value that is showed
is different from the one that is in memory

have you tried my example of the problem ? , try it out and you will see
that this must be a serious bug .

by the way i found that this is enough to solve the problem

Option Strict On
Option Explicit On
Public Class CustomDateTimePicker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(ByVal e As
System.ComponentModel.CancelEventArgs)
MyBase.Visible = True
MyBase.OnValidating(e)
End Sub
End Class
regards

Michel

"Cor Ligthert [MVP]" wrote:
Michel,

Validating a date-time picker?

Is that something they do in Rotterdam?

You can in my idea better validate if the water there is clear enough to
drink.

:-)

Cor

"Michel Posseth [MCP]" <Mi**************@discussions.microsoft.comschre ef
in bericht news:F1**********************************@microsof t.com...

I have a problem with the date time picker validate event wich i believe
is
a bug
How to reproduce :

throw on a form a date time picker control and a textbox control

select the validating event of the control and add this code

Private Sub DateTimePicker1_Validating(ByVal sender As System.Object,
ByVal
e As System.ComponentModel.CancelEventArgs) Handles
DateTimePicker1.Validating
TextBox1.Text = Me.DateTimePicker1.Text
End Sub

start the project

change the standard value of the control but only the day or month ( not
the
year ) now move away from the control with a tab

The textbox will show a different value as there is currently showed on
your
screen by the date time picker
does someone have a good explanation for this ?

regards

Michel




Nov 24 '06 #4
Michel,

Don't take it serious, I saw the validating event and than thought is that
the right place, I made the message. After a while I thought, you are of
course testing the given date to certain possibilities, not if the given
date is correct.

I can assure you that I don't have to test things you say, I take it on your
word.

However sometimes I can not resist.

Cor

"Michel Posseth [MCP]" <Mi**************@discussions.microsoft.comschre ef
in bericht news:BB**********************************@microsof t.com...
Well Cor ,,,
I currently work in a energy company , an we write software that
calculates
energy bills .

A bill has to be made in a certain range of a time span

so before we create new entry`s in the database we would like to
"validate"
this entered range, however it gets a bit tricky if the value that is
showed
is different from the one that is in memory

have you tried my example of the problem ? , try it out and you will see
that this must be a serious bug .

by the way i found that this is enough to solve the problem

Option Strict On
Option Explicit On
Public Class CustomDateTimePicker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(ByVal e As
System.ComponentModel.CancelEventArgs)
MyBase.Visible = True
MyBase.OnValidating(e)
End Sub
End Class
regards

Michel

"Cor Ligthert [MVP]" wrote:
>Michel,

Validating a date-time picker?

Is that something they do in Rotterdam?

You can in my idea better validate if the water there is clear enough to
drink.

:-)

Cor

"Michel Posseth [MCP]" <Mi**************@discussions.microsoft.com>
schreef
in bericht news:F1**********************************@microsof t.com...
>
I have a problem with the date time picker validate event wich i
believe
is
a bug
How to reproduce :

throw on a form a date time picker control and a textbox control

select the validating event of the control and add this code

Private Sub DateTimePicker1_Validating(ByVal sender As System.Object,
ByVal
e As System.ComponentModel.CancelEventArgs) Handles
DateTimePicker1.Validating
TextBox1.Text = Me.DateTimePicker1.Text
End Sub

start the project

change the standard value of the control but only the day or month (
not
the
year ) now move away from the control with a tab

The textbox will show a different value as there is currently showed on
your
screen by the date time picker
does someone have a good explanation for this ?

regards

Michel




Nov 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an...
13
by: Deano | last post by:
Hi, I generate a report using two dates (From and To). I notice if I enter 01/10/2003 that it is interpreted by Access as 10/01/2003 i.e 10th January rather than 1st October as I intended. ...
2
by: Frank Rocco | last post by:
Hello, Are there any free or inexpensive date and time picker controls that validate? I need to be able to have the control to just display a date or just display a time for editing. Thanks...
7
by: XmlAdoNewbie | last post by:
Hi All, I am wondering if it is possible to allow nulls or empty strings when it comes to the datetimepicker control. I have an app with a few datetimepickers on it and there are some instances...
3
by: gregmalenky | last post by:
Visual C# 2005 Express - I am creating a employee scheduling program for work. When I need to do is for the program to open with a start date of the previous sunday. I also want the ability to...
4
by: Michael Turner | last post by:
Hi Guys I have two DateTime pickers one shows the Date and the other the time, this is a requirement of the solution. The problem I have is that when the time is saved to the sql database into a...
0
by: obuli | last post by:
In VB.NET Form,i am using Date Time Picker How to fire "Date Time Picker" 's Click and "Double Click" events... It seems these events are not fired.. any one please help me .. thanks in...
0
by: JaimeM26 | last post by:
How can I capture a keypress on a date time picker when the calendar is in a "Dropped Down" state? I am trying to capture the "ESC" keypress when the drop down calendar is showing. Right now It...
0
by: fredloh | last post by:
i have a tab control on my form. i then have several microsoft date and time picker control on the tab control. when i select a date on any of the date and time picker control, the result of the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.