Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,550 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,565 people online right now. Registration is fast and FREE... Join Now!




How to make a button play more than 1 picture

 
Reply to this topicStart new topic

How to make a button play more than 1 picture

Learner15
15 Nov, 2007 - 12:36 PM
Post #1

New D.I.C Head
*

Joined: 15 Nov, 2007
Posts: 5


My Contributions
CODE
Imports System.Media
Public Class frmPhoto


    Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
        Dim intcount As Integer

        If intcount = 4 Then
            intcount = 1
        Else
            intcount += 1

        End If

        Select Case intcount

            Case 1
                picPhoto.BackgroundImage = My.Resources.mediatrailer
                My.Computer.Audio.Play(My.Resources.hello, AudioPlayMode.Background)
            Case 2
                picPhoto.BackgroundImage = My.Resources.the_ppl
                My.Computer.Audio.Play(My.Resources.music, AudioPlayMode.Background)
            Case 3
                picPhoto.BackgroundImage = My.Resources.sketchg
                My.Computer.Audio.Play(My.Resources.innocent, AudioPlayMode.Background)
            Case 4
                picPhoto.BackgroundImage = My.Resources.Terry_Fox_Walk_073
                My.Computer.Audio.Play(My.Resources.ozzy, AudioPlayMode.Background)

        End Select
    End Sub


This post has been edited by Learner15: 15 Nov, 2007 - 12:37 PM
User is offlineProfile CardPM
+Quote Post

ahmad_511
RE: How To Make A Button Play More Than 1 Picture
15 Nov, 2007 - 04:40 PM
Post #2

D.I.C Regular
Group Icon

Joined: 28 Apr, 2007
Posts: 351



Thanked: 8 times
Dream Kudos: 400
My Contributions
Hi there.
Just use the "Static" Keyword instead of "Dim"
QUOTE

Specifies that one or more declared local variables are to remain in existence and retain their latest values after termination of the procedure in which they are declared.


Check this

Don't forget to reset "intcount" value at the end of sub
Hope this helps.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: How To Make A Button Play More Than 1 Picture
15 Nov, 2007 - 06:44 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to VB.Net Forum smile.gif
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:43PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month