473,785 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ 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(ByV al sender As System.Object, ByVal
e As System.Componen tModel.CancelEv entArgs) Handles DateTimePicker1 .Validating
TextBox1.Text = Me.DateTimePick er1.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 4876
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 CustomDateTimeP icker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(By Val e As
System.Componen tModel.CancelEv entArgs)
MyBase.Visible = False
MyBase.Visible = True
MyBase.OnValida ting(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(ByV al sender As System.Object, ByVal
e As System.Componen tModel.CancelEv entArgs) Handles DateTimePicker1 .Validating
TextBox1.Text = Me.DateTimePick er1.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.comsc hreef
in bericht news:F1******** *************** ***********@mic rosoft.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(ByV al sender As System.Object,
ByVal
e As System.Componen tModel.CancelEv entArgs) Handles
DateTimePicker1 .Validating
TextBox1.Text = Me.DateTimePick er1.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 CustomDateTimeP icker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(By Val e As
System.Componen tModel.CancelEv entArgs)
MyBase.Visible = True
MyBase.OnValida ting(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.comsc hreef
in bericht news:F1******** *************** ***********@mic rosoft.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(ByV al sender As System.Object,
ByVal
e As System.Componen tModel.CancelEv entArgs) Handles
DateTimePicker1 .Validating
TextBox1.Text = Me.DateTimePick er1.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.comsc hreef
in bericht news:BB******** *************** ***********@mic rosoft.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 CustomDateTimeP icker
Inherits DateTimePicker
Protected Overrides Sub OnValidating(By Val e As
System.Componen tModel.CancelEv entArgs)
MyBase.Visible = True
MyBase.OnValida ting(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******** *************** ***********@mic rosoft.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(ByV al sender As System.Object,
ByVal
e As System.Componen tModel.CancelEv entArgs) Handles
DateTimePicker1 .Validating
TextBox1.Text = Me.DateTimePick er1.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
7106
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 empty database, the date time picker returns error 545. Any attempts to progmatically add new records after the empty database has been opened returns, or to use the DTP and set a new date for those added records, "Field not updateable, Bound...
13
3096
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. This is the old problem of US date format mm/dd/yy versus dd/mm/yy. I am stepping through the code and the dates do seem to be ok but when the report runs I get records earlier than 1st October which is not what I want.
2
2623
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 Frank
7
10781
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 when i don't want a date to show at all but the datetimepickers always have at least todays date in it so when i go to press the save button on my app there is always a date stored in the retrieved field. Is there a way to say "hey i don't want a...
3
7458
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 change the start date to create a new schedule - however, it must begin on a sunday. I want the sunday date to be locked in so it doesn't always show the current date when executed. Also for a prompt to appear if the user tries to use another day...
4
2673
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 datetime field it uses the default date which is a problem when I try to sort, what I wanted to know is there a way for me to set the date in the time picker to the date in the date picker? Any help greatly appreciated.
0
1688
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 advance
0
283
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 will not fire an event, it will simply close the calendar then if I hit "ESC" again, it will fire the dateTimePicker_KeyDown() event. I need to be able to capture it on the first time you hit it, not the second time after the calendar is already...
0
2845
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 control's value is always 12:00:00 am instead of the date i selected even though the date displays correctly on the date and time picker control. the controls are unbound. why is this? i also have another identical form where the date and...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.