473,387 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question about the DateTimePicker object

I'm writing some software that keeps track of issue dates and expiration dates. When a user adds a new record to my database I have code that defaults them to these values. Here is the code that does this......

Expand|Select|Wrap|Line Numbers
  1. Issue_DateDateTimePicker.Value() = Date.Now()
  2.  
  3. If IsDate(DateAdd(DateInterval.Year, 1, Date.Now)) Then
  4.             Expiration_DateDateTimePicker.Value = DateAdd(DateInterval.Year, 1, Date.Now)
  5. Else
  6.             Expiration_DateDateTimePicker.Value = DateAdd(DateInterval.Year, 1, Date.Now)
  7.             While IsDate(DateAdd(DateInterval.Year, 1, Date.Now)) = False
  8.                 Expiration_DateDateTimePicker.Value = DateAdd(DateInterval.Day, -1, Expiration_DateDateTimePicker.Value())
  9.             End While
  10. End If
When I save the record I get an error message that the Issue Date field cannot be null. I have this validation rule set up in the database, but I'm confused as to why this error even occurs. I can pull up message boxes that show the values of both of these objects and they are definitely not null. Any help??
Mar 3 '08 #1
0 703

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Angelina | last post by:
Hi, I have got two DateTimePicker's on my form to accept a guest arrival date and departure date.what i want to acheieve is ensure that the DateTimePicker2 (departure) is always greater than...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
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...
1
by: skhairnar | last post by:
Hi All, I am trying to write a validation rule for DateTimePicker, which will prevent user from selecting saturday or sunday as a value. For this I have added an event handler with following code:...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
1
by: Kevin | last post by:
I have put a VS2005 sample project up here: http://www.kevinandkiran.com/CSharpApplication.zip (its only 50k) Basically I have a class that contains a date property, which is initialised to...
1
by: Dom | last post by:
I've created a UserControl comprised of two controls, a DataGridView and a DateTimePicker. I've done this because one of the columns in the DataGridView will hold a date, and when the user clicks...
6
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I found the following code on the Internet which is perfect for my needs with datetimepicker controls: Private Sub dtpOther_ValueChanged(ByVal sender As Object, ByVal e As...
0
by: tschroeder250 | last post by:
Hi Everyone, There are so many Nullable DateTimePickers out there that this post may not even be found among all the others, but I wanted to try. First, I want to thank all the authors of the...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.