Wrox Programmer Forums
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2010, 01:55 AM
Authorized User
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 72
Thanks: 17
Thanked 0 Times in 0 Posts
Thumbs up Image changing every 1 hour

Hi,

I am using asp.net 2.0.

And I have 10 images, On a web page,I want the image to change every one hour.

How this can be done?


Thank You
Anup
 
Old January 26th, 2010, 08:45 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load
Dim D1 AsDate = Now()
Dim Hour1 AsInteger
Hour1 = D1.Hour
SelectCase Hour1
Case 1
Image1.ImageUrl =
"ImageName1.jpg"
Case 2
Image1.ImageUrl =
"ImageName2.jpg"
CaseElse
Image1.ImageUrl = "ImageName3.jpg"
EndSelect

EndSub

__________________
Try our latest project www.nobanx.com Currency Exchange for members
 
Old January 26th, 2010, 09:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This code displays image 1 between 1 and 2 a.m., image 2 between 2 and 3 a.m and image 3 during the other 22 hours in the day...

Instead, you may want to look at the Mod operator, or use another mechanism to display the image....

Cheers,

Imar
---------------------------------------------------------------------------------------------------------------------
Imar Spaanjaars
Web: Imar.Spaanjaars.Com Twitter: ImarSpaanjaars

Author of Beginning ASP.NET 4 : in C# and VB | Beginning ASP.NET 3.5 : in C# and VB | ASP.NET 2.0 Instant Results.
While typing this post, I was listening to: It's In Our Hands by Bjork (Track 15 from the album: Greatest Hits) What's This?

Last edited by Imar; January 26th, 2010 at 09:32 AM..
 
Old January 26th, 2010, 09:29 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

Yes, you're right.

Sorry I didn't mention it as I thought it would be obvious as to how it can be extended to show other images eg:


Case 3
Image1.ImageUrl =
"ImageName3.jpg"

Case 4
Image1.ImageUrl =
"ImageName4.jpg"

etc. etc. etc..................

There are lots of ways of achieving the same effect. I personally like the way www.bbc.co.uk uses something similar to regularly change the colours on the home page.


Note to self: Must try harder
__________________
Try our latest project www.nobanx.com Currency Exchange for members





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hour by Hour Matrix Report Ed_Conde BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 12th, 2008 02:51 PM
Changing the image button on PostBack Aker C# 6 May 19th, 2008 11:20 AM
Changing the Page's Background Image Aaron Edwards ASP.NET 2.0 Basics 0 October 7th, 2006 02:28 PM
Document Image Processing (DIP) - changing image f ALcom Access 0 March 27th, 2006 06:10 AM
dynamic changing of image pandad BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 0 January 5th, 2006 12:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.