Question Date manipulation

dharyadi

New member
Joined
Dec 16, 2019
Messages
1
Programming Experience
Beginner
I have combobox as category (staff and juniorstaff)
Dateedit for select date
monthtxt for show month value
yeartxt for show year value
If user select staff and enter the date If dateedit.value
between 05-dec-2019 andb 04-jan-2020 show monthtxt as 1 and yeartxt as 2020
05-jan-2019 andb 04-feb-2020 show monthtxt as 2 and yeartxt as 2020

Thank.
 
If you are writing your project using WPF or WinForms, you should really be using the built-in date picker controls that come with those frameworks.
 
Anyway, regardless of how you are getting the date from the user, a simple set of if conditions should get you what you need.

Can you share your current code?
 
If you are writing your project using WPF or WinForms, you should really be using the built-in date picker controls that come with those frameworks.
Given that the OP mentions dateedit.value, I'm guessing that it is a WinForms DateTimePicker. We shouldn't have to guess though. The OP should always make it plain with a FULL and CLEAR explanation and ALWAYS include the relevant code.

As suggested though, this is a simple application of an if statement. The OP even says it themselves:
If user select staff and enter the date If dateedit.value
That's your Boolean logic right there. You just need to use the DateTime constructor to create a value from year, month and day values for comparison.
 
You both should know that datepicker in WPF does not use .Value, it uses .SelectedDate instead. .Value will only be valid on a Winforms projects. Winforms forums might also be the more appropriate place for this post.

@dharyadi if you post your troublesome code, it will give these guys something to correct if they're feeling generous.
 

Latest posts

Back
Top Bottom