473,626 Members | 3,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing pictures

4 New Member
i have a splash screen that i want to change a picture once a second for three seconds; then load my main form. what i want it to do is load a picture into a picture box; start a timer which will stop the loop for one second then start the loop again add 1 to the pintcount which will result in the name of aneither picture (my pictures are named 1, 2, 3) i have it in the form load event procedure. this is the code that i have so far. what i have tried to do is put this code in the timer 1 procedure and it resulted in executing the timer and when the timer finished then the code executed, so i moved it to the form load procedure. the problem that i seek help with is: how can i get the timer to execute inside of the loop, becouse without it the loop just fly's through the code and only shows the last picture


Private Sub Form_Load()

Dim pintcount As Integer
Dim pstrloc As String
Dim pstrpicname As String

pintcount = 1
pstrloc = "G:\school\ vis basic\changing pictures1\pictu res\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Pictur e = LoadPicture(pst rpicname)
Timer1.Enabled = True
Form1.Refresh
pintcount = pintcount + 1
Next

If pintcount = 3 Then
Unload Form1
End If
End Sub
Nov 15 '06 #1
2 3108
albertw
267 Contributor
i have a splash screen that i want to change a picture once a second for three seconds; then load my main form. what i want it to do is load a picture into a picture box; start a timer which will stop the loop for one second then start the loop again add 1 to the pintcount which will result in the name of aneither picture (my pictures are named 1, 2, 3) i have it in the form load event procedure. this is the code that i have so far. what i have tried to do is put this code in the timer 1 procedure and it resulted in executing the timer and when the timer finished then the code executed, so i moved it to the form load procedure. the problem that i seek help with is: how can i get the timer to execute inside of the loop, becouse without it the loop just fly's through the code and only shows the last picture


Private Sub Form_Load()

Dim pintcount As Integer
Dim pstrloc As String
Dim pstrpicname As String

pintcount = 1
pstrloc = "G:\school\ vis basic\changing pictures1\pictu res\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Pictur e = LoadPicture(pst rpicname)
Timer1.Enabled = True
Form1.Refresh
pintcount = pintcount + 1
Next

If pintcount = 3 Then
Unload Form1
End If
End Sub
hi
not surpised

you made a for/next loop with printcount, first declare printcount=1, add 1 to printcount in the loop where printcount is the counter and use a statement if printcount=3 outside your for/next loop
printcount will leave the for/next loop as 4

bit confusing

Private Sub Form_Load()

Dim pintcount As Integer
Dim pstrloc As String
Dim pstrpicname As String

pstrloc = "G:\school\ vis basic\changing pictures1\pictu res\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Pictur e = LoadPicture() 'to clear the picture
Picture1.Pictur e = LoadPicture(pst rpicname)
Timer1.Enabled = True
Form1.Refresh
Next

'if your timer will delay pictureswitch for 1 second
'then you can unload your form right after the loop

Unload Form1
End Sub
Nov 15 '06 #2
albertw
267 Contributor
hi
not surpised

you made a for/next loop with printcount, first declare printcount=1, add 1 to printcount in the loop where printcount is the counter and use a statement if printcount=3 outside your for/next loop
printcount will leave the for/next loop as 4

bit confusing

Private Sub Form_Load()

Dim pintcount As Integer
Dim pstrloc As String
Dim pstrpicname As String

pstrloc = "G:\school\ vis basic\changing pictures1\pictu res\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Pictur e = LoadPicture() 'to clear the picture
Picture1.Pictur e = LoadPicture(pst rpicname)
Timer1.Enabled = True
Form1.Refresh
Next

'if your timer will delay pictureswitch for 1 second
'then you can unload your form right after the loop

Unload Form1
End Sub
hi sry forgot the timerdelay
instead of using a timer, you may use

start=Timer : While Timer<start+1: DoEvents : Wend

just after loading the new picture
it's a non-elagant way of delay, but it works
Nov 15 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4357
by: Raymond Dunton | last post by:
I am new to Javascript programming. I have a page with four small pictures. I want to click on a picture and have it open up larger in a popup window. this is what I am currently using to do this: <html> <!-- Generated by AceHTML Freeware http://freeware.acehtml.com --> <!-- Creation date: 7/24/2003 --> <head>
1
2051
by: David | last post by:
Hi, I have a webpage where I want to have a select list which the user can select between two different pictures, and then the chosen picture loads onto the html page, but without having to reload the actual page. At the moment, what I have is a select list as shown below: <form name="orders"> <select name="picture" size="1"> <option value="pic1.jpg">Picture 1</option> <option value="pic2.jpg">Picture 2</option>
23
2682
by: Wade | last post by:
08122005 1505 GMT-5 Hello. I am working on a webpage for the local school (just before school starts). Their outside hired company really screwed things up. Im trying to get their computers up and running and gain access to their apps for them. There is this code that flips through images for World History class. I have removed the code from the page but the page still does not function.
3
1916
by: Wade | last post by:
08242005 1416 GMT-5 Recently some of you helped me with a script to change images. Well I was asked to make a change to the script and not knowing if what the school system is even possible, Ill ask you all. The script just loads some images and roates through them. However, the school wants to be able to put more and more pictures in the folder and the script pull all the images for rotation.
6
9466
by: John Ortt | last post by:
Hi there everyone, I have a part info form which has a faded image of our company logo as a background. I want to replace the faded image with a bright red warning image on items which have run out of purchasing cover. I am nearly there, the only problem is that the code below only changes the image background for text and combo-box backgrounds, it doesn't apply it to the whole form.
4
3470
by: Doug van Vianen | last post by:
Hi, I have the following coding on a web page. It causes two pictures (pic1.jpg and pic2.jpg) to show, one above the other and then when one clicks on the top picture is squeezes to the left (as its width is reduced) to show the bottom picture. Then when the bottom picture is clicked the top picture expands to the right to cover the bottom picture again.
10
1793
by: Anthony | last post by:
I am using the following code to display fading pictures on a team website. Can someone show me how to modify it such that I can display the names of each employee when the picture changes? This is not the complete code for the page but only the code relevant to what I am asking here. Some background information for you: the page is set up using a layout table and the pictures are displayed in a layout cell.I appreciate any help. ...
0
1188
by: hanisimo | last post by:
I am trying to write a small program to replace pictures in PowerPoint presentation... To find the pictures, I check Shape Type (Shape.Type = msoPicture)... But the problem is: how can I change the picture after this step? What is the method I should use to load the new picture from file to the Shape? Best regards and have a nice day,
1
1600
by: larystoy | last post by:
Newbie to VB6, comfortable with HTML, MS Access so I ain't totally stupid. Maybe just dumb. Am writing a Biblical Quiz program where I need to change a picture and midi sound file each time a user advances to a new question. Have played with several routines but none seem to do what I want. The following will show the first picture, on click shows the second picture, on the next click shows the third picture. Each click thereafter...
0
8265
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
8705
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
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8504
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...
1
6125
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
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1808
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.