473,500 Members | 1,967 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\pictures\"

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

If pintcount = 3 Then
Unload Form1
End If
End Sub
Nov 15 '06 #1
2 3098
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\pictures\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Picture = LoadPicture(pstrpicname)
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\pictures\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Picture = LoadPicture() 'to clear the picture
Picture1.Picture = LoadPicture(pstrpicname)
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\pictures\"

For pintcount = 1 To 3
pstrpicname = pstrloc & pintcount & ".jpg"
Picture1.Picture = LoadPicture() 'to clear the picture
Picture1.Picture = LoadPicture(pstrpicname)
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
4353
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...
1
2038
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...
23
2660
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...
3
1900
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...
6
9443
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...
4
3450
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...
10
1773
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...
0
1172
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...
1
1595
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...
0
7136
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,...
0
7232
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...
0
7397
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...
0
5490
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,...
0
4611
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...
0
3110
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...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
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 ...
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.