473,383 Members | 1,725 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,383 software developers and data experts.

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 7440
"gregmalenky" <gr*********@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.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, "gregmalenky"
<gr*********@discussions.microsoft.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(object sender, System.EventArgs e)
{
// get the day of the week
int weekDay = (int)DateTime.Now.DayOfWeek;

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

//Set the DateTimePicker's date to the result
dateTimePickerSunday.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, "gregmalenky"
<gr*********@discussions.microsoft.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, "gregmalenky"
<gr*********@discussions.microsoft.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(object sender, System.EventArgs e)
{
// get the day of the week
int weekDay = (int)DateTime.Now.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.AddDays(weekDay * -1);

//Set the DateTimePicker's date to the result
dateTimePickerSunday.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
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...
13
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...
3
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...
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...
2
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...
4
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...
2
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...
4
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.