Click here to Skip to main content
16,006,428 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Event hander of multiple buttons Pin
tbryce31117-Dec-06 4:56
tbryce31117-Dec-06 4:56 
GeneralRe: Event hander of multiple buttons Pin
Dave Kreskowiak17-Dec-06 6:15
mveDave Kreskowiak17-Dec-06 6:15 
AnswerRe: Event hander of multiple buttons Pin
Guffa17-Dec-06 9:14
Guffa17-Dec-06 9:14 
AnswerRe: Event hander of multiple buttons Pin
Thomas Stockwell17-Dec-06 4:49
professionalThomas Stockwell17-Dec-06 4:49 
QuestionLoad Values from registry into checkedlistbox Pin
guayony16-Dec-06 8:17
guayony16-Dec-06 8:17 
QuestionRe: Load Values from registry into checkedlistbox Pin
Are Jay16-Dec-06 19:43
Are Jay16-Dec-06 19:43 
QuestionChange Button Name, and Image When Button is Clicked [modified] Pin
Skullie8416-Dec-06 6:38
Skullie8416-Dec-06 6:38 
AnswerRe: Change Button Name, and Image When Button is Clicked Pin
The ANZAC16-Dec-06 10:48
The ANZAC16-Dec-06 10:48 
On your form, add your picturebox, your button, an imagelist and a timer. In the code i will be giving you, everything is named to default (e.g. button1, picturebox1, imagelist1, timer1), you will have to rename these if your's are named different.

Do this in declarations:
Dim ICount As Integer = 0 ' declare the counter for our images

Form Load:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
    Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(0) ' Set the picture box to display the first image in the series<br />
    Me.PictureBox1.BackgroundImageLayout = ImageLayout.Stretch ' Make the image stretched ''This is optional<br />
End Sub


Button Click:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
     If Me.Button1.Text = "move" Then ' if the timer isn't running and the text = "move" then<br />
         Me.Button1.Text = "stop" ' change the text<br />
         Me.Timer1.Enabled = True ' and start the timer<br />
     Else ' if it is running and the text = "stop" then<br />
         Me.Button1.Text = "move" ' change the text<br />
         Me.Timer1.Enabled = False ' and stop the timer<br />
     End If<br />
 End Sub


Timer Tick:
<br />
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
        'index for images starts at zero, so on the tenth image the index will be 9, so we have to minus one to accomodate<br />
        If ICount = Me.ImageList1.Images.Count - 1 Then 'Check if it's at the last image, and start again if so<br />
            Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(0) ' change to first image<br />
            ICount = 1 'set the count for the next image<br />
        Else<br />
            Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(ICount) ' if it's not the last image, go to next image<br />
            ICount += 1 'set the count for the next image<br />
        End If<br />
        ' the icount is an integer that is increased after each change, then each subsequent change will be the next image in series<br />
    End Sub<br />


Posted by The ANZAC

GeneralRe: Change Button Name, and Image When Button is Clicked Pin
Skullie8418-Dec-06 3:55
Skullie8418-Dec-06 3:55 
GeneralRe: Change Button Name, and Image When Button is Clicked Pin
The ANZAC18-Dec-06 9:46
The ANZAC18-Dec-06 9:46 
QuestionRich Text Box in VB .net that support graphics Pin
Nirav N Soni16-Dec-06 4:07
Nirav N Soni16-Dec-06 4:07 
QuestionRead mp3 file Pin
SilentBob10115-Dec-06 23:36
SilentBob10115-Dec-06 23:36 
AnswerRe: Read mp3 file Pin
Guffa16-Dec-06 0:07
Guffa16-Dec-06 0:07 
Questionremember me on same computer!!! Pin
Ashish Porwal15-Dec-06 20:16
Ashish Porwal15-Dec-06 20:16 
AnswerRe: remember me on same computer!!! Pin
MatrixCoder15-Dec-06 20:22
MatrixCoder15-Dec-06 20:22 
AnswerRe: remember me on same computer!!! Pin
amaneet15-Dec-06 20:39
amaneet15-Dec-06 20:39 
AnswerRe: remember me on same computer!!! Pin
toxcct22-Jan-07 9:05
toxcct22-Jan-07 9:05 
Questionms access Pin
latharedy15-Dec-06 19:59
latharedy15-Dec-06 19:59 
AnswerRe: ms access Pin
Agus Budianto27-Dec-06 3:26
Agus Budianto27-Dec-06 3:26 
QuestionI have changed the webpage name from webform1.aspx to stdents.aspx and i debugged it. I got an error like:... Pin
tirumal123115-Dec-06 19:47
tirumal123115-Dec-06 19:47 
AnswerRe: I have changed the webpage name from webform1.aspx to stdents.aspx and i debugged it. I got an error like:... Pin
Are Jay16-Dec-06 19:50
Are Jay16-Dec-06 19:50 
Questiondrawing function (PaintEventArgs) Pin
charchabil0315-Dec-06 9:49
charchabil0315-Dec-06 9:49 
AnswerRe: drawing function (PaintEventArgs) Pin
charchabil0315-Dec-06 11:25
charchabil0315-Dec-06 11:25 
QuestionRe: drawing function (PaintEventArgs) Pin
Are Jay16-Dec-06 19:47
Are Jay16-Dec-06 19:47 
AnswerRe: drawing function (PaintEventArgs) Pin
charchabil0316-Dec-06 22:59
charchabil0316-Dec-06 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.