473,660 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date time picker weekly

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 other than sunday.

I will also have daily headers for each column with the day and date listed.
Can I just use the datetimepicker value and add "1" to each column?

Thank you,
Greg Malenky
Nov 17 '05 #1
3 7451
"gregmalenk y" <gr*********@di scussions.micro soft.com> wrote in message
news:38******** *************** ***********@mic rosoft.com...
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 other than
sunday.

I will also have daily headers for each column with the day and date
listed.
Can I just use the datetimepicker value and add "1" to each column?


Dunno if this'll help:
http://www.codingsanity.com/planner.htm

It's more designed for having the days as rows and hours as columns though.
Nov 17 '05 #2
Otis,

close to what I need - however, I want the program to open showing the
previous sunday's date (not when the datetimepicker is changed). Also, I need
the program to allow a user to change the date to the following (or future)
sundays. If sunday is not chosen, then a msgbox appears "you must start the
week on sunday"

Thanks,
Greg

"Otis Mukinfus" wrote:
On Thu, 7 Jul 2005 08:15:13 -0700, "gregmalenk y"
<gr*********@di scussions.micro soft.com> wrote:
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 other than sunday.

I will also have daily headers for each column with the day and date listed.
Can I just use the datetimepicker value and add "1" to each column?

Thank you,
Greg Malenky


private void MainForm_Load(o bject sender, System.EventArg s e)
{
// get the day of the week
int weekDay = (int)DateTime.N ow.DayOfWeek;

// Subtracting the week day from the current day yields zero
// (the previous Sunday)
DateTime sunday = DateTime.Now.Ad dDays(weekDay * -1);

//Set the DateTimePicker' s date to the result
dateTimePickerS unday.Value = sunday;
}

Does that do what you want?
Otis Mukinfus
http://www.otismukinfus.com

Nov 17 '05 #3
Thanks Otis,

I saw where I made the mistake.

Greg

"Otis Mukinfus" wrote:
On Fri, 8 Jul 2005 11:42:02 -0700, "gregmalenk y"
<gr*********@di scussions.micro soft.com> wrote:

See below
Otis,

close to what I need - however, I want the program to open showing the
previous sunday's date (not when the datetimepicker is changed). Also, I need
the program to allow a user to change the date to the following (or future)
sundays. If sunday is not chosen, then a msgbox appears "you must start the
week on sunday"

Thanks,
Greg


Interesting. I thought the example I gave you set the datetime picker to the
previous Sunday and since it's in the FormLoad event it sets the dtp when the
program loads. I think that's two of your requirements. The rest is up to you.
;o)

You didn't test the code or you would have seen the result you wanted.

See below...

"Otis Mukinfus" wrote:
On Thu, 7 Jul 2005 08:15:13 -0700, "gregmalenk y"
<gr*********@di scussions.micro soft.com> wrote:

>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 other than sunday.
>
>I will also have daily headers for each column with the day and date listed.
>Can I just use the datetimepicker value and add "1" to each column?
>
>Thank you,
>Greg Malenky

Load event occurs when the program is opened private void MainForm_Load(o bject sender, System.EventArg s e)
{
// get the day of the week
int weekDay = (int)DateTime.N ow.DayOfWeek;

// Subtracting the week day from the current day yields zero
// (the previous Sunday) Does this not set the date to the previous sunday? DateTime sunday = DateTime.Now.Ad dDays(weekDay * -1);

//Set the DateTimePicker' s date to the result
dateTimePickerS unday.Value = sunday;
}

Does that do what you want?
Otis Mukinfus
http://www.otismukinfus.com


Otis Mukinfus
http://www.otismukinfus.com

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7096
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
3851
by: Hussein Patwa | last post by:
Hi there. I'm new to this group. I'm also partially sighted so navigating the web is sometimes quite difficult. I'm looking for a javascript date picker, you know the ones that travel sites use for selecting the departure and arrival dates. I've had a look at some sites, but mostly found calendars. I want to make mys tie accessible, so I really want the three scroll boxes for the day, month and year.
3
5238
by: TD | last post by:
This code doesn't work. Every posting I can find suggests that it should. If TypeOf controlname Is DTPicker then do something here End If I am using the Date Time Picker control and wish to use TypeOf to determine if the controlname is indeed a Date Time Picker control.
7
10768
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...
2
3949
by: Need Helps | last post by:
The example given in msdn.com on how to create a Date Time Picker involves using the CreateWindowEx function. However, I created a dialog box using the graphical interface, and then used the graphical interface to add a Date Time Picker control to it. The only problem is, I don't know how to do anything with the Date Time Picker, like access the date selected within the control. All I have is the ID, which in my code is IDC_DATETIMEPICKER1. ...
4
2664
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.
2
2410
by: Darhl Thomason | last post by:
I'm converting my Access 2003 VBA app. I have a number of date fields in my db that I want to use the date/time picker control with, but if there is no entry in my database, I want the date/time picker to show no date. Right now the first time it shows a blank date record, it inserts today's date. But as I move through the db and it finds a date in that field, the next time it finds a blank data record, it uses the last one as the...
4
4868
by: Michel Posseth [MCP] | last post by:
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
0
2840
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
8428
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
8341
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
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8630
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...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
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.