VB 2005: How to display a multiple number of pics in a picBox at an interval of 2 secs?

Dear Experts:

Hi again!

I would like to learn how to display a multiple number of pictures in a picbox at an interval of
2-3 seconds with fadein and fadeout effects.

Thanks a lot!
dutaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jjardineCommented:
To just switch the images you would have to set up a timer that would programmatically update the image.   The fading in and out may be a lot more difficult as I don't think that those properties are built in.  The only thing I can think of would be able to change the opacity of the control if that is even possible.  Not sure that is available for that control.   Maybe some one else will know of a better solution, those are just my initial thoughts.
0
dutaAuthor Commented:
Can you kindly give me the code to implement your tip?

Thanks a lot!
0
jjardineCommented:
Here is a link to show how to possibly do the fade in and out.   http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/477830bb-f3f2-4d19-90b7-f81599de7f7d/

I have attached sample code for the timer functionality to just swap the images without a fade:
Public Class Form1
    Dim Timer1 As New Timer()
    Dim imagePath As String = "C:\Documents and Settings\user\My Documents\My Pictures\"
 
    Dim Images() As String = New String() {"Picture1.gif", "picture2.gif"}
    Dim index As Integer = 0
 
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Timer1.Stop()
    End Sub
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 3000
        AddHandler Timer1.Tick, AddressOf Timer_Tick
        Timer1.Start()
    End Sub
 
    Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
        If index > Images.Length - 1 Then
            index = 0
        End If
        pb.Image = Image.FromFile(imagePath & Images(index))
        index += 1
 
    End Sub
End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dutaAuthor Commented:
Thank you so much for your kind tips.

By the way, I would like to put all the images in the Resource folders so that I don't have to change
the paths when I open the project at other platforms or workstations.

Thanks a lot!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.