By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,062 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Changing pictures and playing MIDI files

P: 9
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 just rotates between pics 2 and 3. I have 9 pictures that need to be rotated or randomly sellected on each NEXT Question sellection.

This structure should do, but can not figure out how to change Picture2.Picture with either rotating or random method.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.  
  3. 'Description: Displays a two frame animation using a timer
  4. 'Place code in timer and set interval as needed
  5.  
  6. Static Choice As Integer
  7. 'Uses 3 picture boxes.
  8. 'Picture1 - visible display   Picture2&3 - pictures
  9. If Choice Then
  10.     Picture1.Picture = Picture2.Picture
  11. Else
  12.     Picture1.Picture = Picture3.Picture
  13. End If
  14.  
  15. Choice = Not Choice
  16.  
  17. End Sub
Next stupid question - What does the "." do in a command ?

Also any URL's for good "Dummy - Dummy's for VB6"

At least I did get one function to work correctly, I have an animated dove that was too lazy to flap his wing when flying across the screen. Of course VB6 doesn't see animated GIF's, so got this one figured out by extracting the 15 individual GIF pictures and using the following routine he does fly across as I want him to do.

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Timer3_Timer()
  4.     picAnimate.Top = 1 'set location from top of screen
  5.  
  6. 'Static variables keep there value with each procedure call
  7.  Static currentpic As Integer
  8.  
  9.     'Determines if the animation is at the last picture and starts
  10.     'at the beginning if so
  11.     If currentpic = 14 Then currentpic = -1
  12.  
  13.     'moves to the next picture
  14.     currentpic = currentpic + 1
  15.  
  16.     'moves the picture to the left
  17.     picAnimate.Left = picAnimate.Left + 55 'orig setting 400
  18.  
  19.     'determines if image is off screen
  20.     '-3600's causes a slight delay in the animation coming back around
  21.     If (picAnimate.Left) > ScaleWidth Then picAnimate.Left = -1000 ' orig -3600
  22.  
  23.     'changes the image to the new image
  24.     picAnimate.Picture = imgDove(currentpic).Picture
  25.  
  26. End Sub
Thanks for any assistance.
Nov 23 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
...I have 9 pictures that need to be rotated or randomly sellected on each NEXT Question sellection.
Put the images into a control array of Image or Picturebox controls. Then use a random number as the index to pick them up from the array.

Next stupid question - What does the "." do in a command ?
Can you explain what you mean by that question?

You will encounter a lot of dots being used as delimiters between parts of a property or variable name. For example, Textbox1.Text refers to the Textbox1 control, Text property.[/quote]

Also any URL's for good "Dummy - Dummy's for VB6"
No idea.


At least I did get one function to work correctly, I have an animated dove that was too lazy to flap his wing when flying across the screen.
Yo umight check out the animation control, to see whether it's appropriate for your situation. I think you would need to convert the animation to AVI format, though.

And of course there are ways to get VB to display an animated GIF, though I can't remember them right now.
Nov 29 '07 #2

Post your reply

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