473,326 Members | 2,110 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,326 software developers and data experts.

show following year and passed

I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?
Apr 27 '06 #1
10 1218
Hello CSharpguy - If I understand your question correctly, I would think that
DateTime is your friend. You can use a DateTime object and then call the
appropriate method .AddDays(), .AddMonths(), or AddYears() - add negative
numbers to go backwards. It will do all the all the calendar stuff for you.
--
brians
http://www.limbertech.com
"CSharpguy" wrote:
I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?

Apr 27 '06 #2
What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.

Apr 27 '06 #3
You want to play with the system.DateTime class. E.g.

System.DateTime.Now.AddYears(1) will return a DateTime object that is todays
date next year

System.DateTime.Now.AddYears(-3) will return a DAtTime from 3 years ago.

"CSharpguy" wrote:
I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?

Apr 27 '06 #4
I tried the addyears() and it just showe 4/30/2007 - 4/30/2006 - 4/30/2005,
etc.

I need to get end of month for all months for one year ahead and 5 years back

"brians[MCSD]" wrote:
Hello CSharpguy - If I understand your question correctly, I would think that
DateTime is your friend. You can use a DateTime object and then call the
appropriate method .AddDays(), .AddMonths(), or AddYears() - add negative
numbers to go backwards. It will do all the all the calendar stuff for you.
--
brians
http://www.limbertech.com
"CSharpguy" wrote:
I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?

Apr 27 '06 #5
The end of the month is on the same day every year, i.e. the end of january
is the 31st in whatever year it is. What exactly do you mean?

"CSharpguy" wrote:
I tried the addyears() and it just showe 4/30/2007 - 4/30/2006 - 4/30/2005,
etc.

I need to get end of month for all months for one year ahead and 5 years back

"brians[MCSD]" wrote:
Hello CSharpguy - If I understand your question correctly, I would think that
DateTime is your friend. You can use a DateTime object and then call the
appropriate method .AddDays(), .AddMonths(), or AddYears() - add negative
numbers to go backwards. It will do all the all the calendar stuff for you.
--
brians
http://www.limbertech.com
"CSharpguy" wrote:
I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?

Apr 27 '06 #6
the thing is I need to show the dates in the same drop down box. I can get
passed years, I got future years, but how can I now put them into one drop
down?

"tdavisjr" wrote:
What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.

Apr 27 '06 #7
i got it to work. I modified the addMonth() and got my results

"CSharpguy" wrote:
the thing is I need to show the dates in the same drop down box. I can get
passed years, I got future years, but how can I now put them into one drop
down?

"tdavisjr" wrote:
What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.

Apr 27 '06 #8
DropDownList MyDDL = new DropDownList();
MyDDL.Items.Add(DateTime.Now.AddYears(1).ToString( ));
MyDDL.Items.Add(DateTime.Now.AddYears(-1).ToString());

"CSharpguy" wrote:
the thing is I need to show the dates in the same drop down box. I can get
passed years, I got future years, but how can I now put them into one drop
down?

"tdavisjr" wrote:
What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.

Apr 27 '06 #9
I was able to get it to work without doing that. I just made a change to the
addMonths() and got it working in the same dropdown

"clickon" wrote:
DropDownList MyDDL = new DropDownList();
MyDDL.Items.Add(DateTime.Now.AddYears(1).ToString( ));
MyDDL.Items.Add(DateTime.Now.AddYears(-1).ToString());

"CSharpguy" wrote:
the thing is I need to show the dates in the same drop down box. I can get
passed years, I got future years, but how can I now put them into one drop
down?

"tdavisjr" wrote:
What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.

Apr 27 '06 #10
I really have no idea what you are going on about, but i am glad that
whatever you did worked for you.

"CSharpguy" wrote:
I was able to get it to work without doing that. I just made a change to the
addMonths() and got it working in the same dropdown

"clickon" wrote:
DropDownList MyDDL = new DropDownList();
MyDDL.Items.Add(DateTime.Now.AddYears(1).ToString( ));
MyDDL.Items.Add(DateTime.Now.AddYears(-1).ToString());

"CSharpguy" wrote:
the thing is I need to show the dates in the same drop down box. I can get
passed years, I got future years, but how can I now put them into one drop
down?

"tdavisjr" wrote:

> What about the DateTime.AddYears(int value) Method?
>
> You can use a loop to to pass in a variable year as the parameter to
> this method and add that date to the dropdown list. Passing a negative
> value with go back a year, and a positive value will add a year.
>
>

Apr 27 '06 #11

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

Similar topics

20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
3
by: Mori | last post by:
I have the following xml. I need to use XPath to get the year when ever the style is pickup. Both year and style are siblings. <?xml version="1.0" encoding="UTF-8"?> <automobiles>...
4
by: Vasilis X | last post by:
Hello. I want to use the excel function Year( ) (or Day, Month, Minute etc...) in a Visual Basic .net application. How can i do this? I tried Excel.WorksheetFunction but this class doesn't...
6
by: Sridhar | last post by:
Hi, I need to display a calendar that shows all the months of an year. In that, I need to show different colors for certain events. I know how to display a calendar for a certain month but I am...
3
by: Amanda | last post by:
Can anyone help me to display the output in MessageBox for the following program result?...
3
by: BerkshireGuy | last post by:
I need a query to include a field called SettlementDate. When the user runs the query, I need to prompt for "Enter Year" and show the last three years of SettlementDate. Can seem to get the...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
7
by: kooroshkdt | last post by:
hi everyone, i'm not beginner but i learn programing in hack kind, i don;t have any idea about my problem(in C++ wrote)!!! Read Plz post if u have any Idea, i want to here it, it will be...
5
by: rushtona | last post by:
I'm trying to build an Access Query that will give me the year and the total catch, even if there was no catch. The problem is if there was no catch for a certain year the query is not showing that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.