February 20, 2005 at 8:55 pm
hi all
Q1) I am using vb.net 2002 and sql server for my project.
When I bind the NULL value (SQL Server, datatype = datetime) to a date time picker vb.net....it return me an error
Q2) How to make the date time picker in vb.net which allow is to insert a blank value????
Can anyone help me to solve this problem
February 22, 2005 at 2:27 am
re. Q1) Have you thought about using the sqlDateTime data type which supports nulls? using System.Data.SqlTypes;
Not quite sure I understand the second question..perhaps you could expand a bit.
Cheers
Andy
February 22, 2005 at 8:30 am
Hi andy
for question 2, i mean the value in the date time picker always shown in the text box, it not allow me to delete the date or make it blank. For my case i need the date become blank. please help
thanks for reply....
loon
February 22, 2005 at 8:40 am
I guess you need to create your own version of the datepicker that inherits the datetime picker and allow it to have a null value. Not sure how you go about this...have not really had much time to play with dot net. I think the general idea of the datetimepicker control is to insist on getting a date out of it which is why it does not allow null. You could just use a text box and have date validator controls. Must rush...should really be working!
Cheers
Andy
Also loon
February 23, 2005 at 6:13 am
The datetimepicker exhibits a similar problem from vb6; when there is no date, I wanted it to be blank...i think it defaults to current date.
In vb6, this trick will hide the date:
dtcompldt.Checkbox = True
If IsNull(dtcompldt.value) Then
dtcompldt.CustomFormat = " "
Else
dtcompldt.CustomFormat = "MM-dd-yyyy"
End If
The same trick might work in .NET
Hope that helps.
Lowell
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy