DateTimePicker
-
I am using a datetimepicker in my VB 2005 express application I wan to Initialize the DTPicker as per the user input Restrict the min and max values as per user input Also keep on changing these settings in the application as user is allowed to change/edit input I tried using can any one please help me with it I had tried codes like the following DTPk_reg_day.Value = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) is there any provision of NULL value?? DTPk_reg_day.MinDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) DTPk_reg_day.MaxDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, DTPk_reg_day.Value.MaxValue.Day) But i am mot successful in achieving all the requirements at the same time Is there any ways i can also have a NULL value
-
I am using a datetimepicker in my VB 2005 express application I wan to Initialize the DTPicker as per the user input Restrict the min and max values as per user input Also keep on changing these settings in the application as user is allowed to change/edit input I tried using can any one please help me with it I had tried codes like the following DTPk_reg_day.Value = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) is there any provision of NULL value?? DTPk_reg_day.MinDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) DTPk_reg_day.MaxDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, DTPk_reg_day.Value.MaxValue.Day) But i am mot successful in achieving all the requirements at the same time Is there any ways i can also have a NULL value
nishkarsh_k wrote:
Is there any ways i can also have a NULL value
No. A Datetime cannot be null, nor can any of it's parameters.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I am using a datetimepicker in my VB 2005 express application I wan to Initialize the DTPicker as per the user input Restrict the min and max values as per user input Also keep on changing these settings in the application as user is allowed to change/edit input I tried using can any one please help me with it I had tried codes like the following DTPk_reg_day.Value = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) is there any provision of NULL value?? DTPk_reg_day.MinDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, 1) DTPk_reg_day.MaxDate = New Date(Val(cmb_reg_year.Text), cmb_reg_month.SelectedIndex + 1, DTPk_reg_day.Value.MaxValue.Day) But i am mot successful in achieving all the requirements at the same time Is there any ways i can also have a NULL value
Hi, The Microsoft DateTimePicker must be given a value type (a DateTime) and therefore can't accept null values. There are a lot of more or less usable solutions to solve this issue, some can be found here on CodeProject. If a commercial solution is an option, I would recommend Smart FieldPackEditor.Net which has been built from the ground up to solve all the DateTimePicker shortcomings.
Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker