Click here to Skip to main content
15,667,983 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Paint Event Problem Pin
Dave Kreskowiak16-May-12 4:54
mveDave Kreskowiak16-May-12 4:54 
GeneralRe: Paint Event Problem Pin
Clark Kent12316-May-12 4:56
professionalClark Kent12316-May-12 4:56 
GeneralRe: Paint Event Problem Pin
Dave Kreskowiak16-May-12 7:05
mveDave Kreskowiak16-May-12 7:05 
GeneralRe: Paint Event Problem Pin
Clark Kent12316-May-12 7:27
professionalClark Kent12316-May-12 7:27 
AnswerRe: Paint Event Problem Pin
Luc Pattyn15-May-12 14:31
sitebuilderLuc Pattyn15-May-12 14:31 
GeneralRe: Paint Event Problem Pin
Clark Kent1238-Nov-12 4:30
professionalClark Kent1238-Nov-12 4:30 
QuestionChanging JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 12:02
Dr David Johnson PhD14-May-12 12:02 
AnswerRe: Changing JPG in picturebox with loop Pin
Dave Kreskowiak14-May-12 13:18
mveDave Kreskowiak14-May-12 13:18 
First, using goto is akin to farting loudly in church. You just don't do it.

It doesn't work because your code is hogging the UI thread. This means that since your code isn't giving up control the UI thread can't process the PAINT messages that are coming into your app from Windows (updating the image you see on screen). The end result it that you only see the last image you set when your loop is done.

How do you get around this?? Forget the loop and use a Timer. Set the Timer to fire an event every 250 milliseconds or so. Start (enable) the Timer in your button Click event.

When your code to change which frame you see will be in the Timer.Tick event. Something like this:
    Private RNG As New Random
.
.
.
    Private Sub MyTimer_Tick(...) Handles MyTimer.Tick
        Dim index As Integer = RNG.Next(0, ImageList3.Images.Count)
        PictureBox3.Image = PictureBox2.Image
        PictureBox2.Image = PictureBox1.Image
        PictureBox1.Image = ImageList3.Images(index)
    End Sub


You don't need to put Me. in front of everything.

GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 15:29
Dr David Johnson PhD14-May-12 15:29 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn14-May-12 15:43
sitebuilderLuc Pattyn14-May-12 15:43 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 17:14
Dr David Johnson PhD14-May-12 17:14 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn14-May-12 17:34
sitebuilderLuc Pattyn14-May-12 17:34 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 17:59
Dr David Johnson PhD14-May-12 17:59 
GeneralRe: Changing JPG in picturebox with loop Pin
dg6yhw1115-May-12 6:38
dg6yhw1115-May-12 6:38 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD15-May-12 11:24
Dr David Johnson PhD15-May-12 11:24 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn15-May-12 12:06
sitebuilderLuc Pattyn15-May-12 12:06 
QuestionDevshock.Net Pin
Midnight Ahri13-May-12 17:15
Midnight Ahri13-May-12 17:15 
AnswerRe: Devshock.Net Pin
Richard MacCutchan13-May-12 22:01
mveRichard MacCutchan13-May-12 22:01 
GeneralRe: Devshock.Net Pin
Midnight Ahri13-May-12 22:42
Midnight Ahri13-May-12 22:42 
GeneralRe: Devshock.Net Pin
Richard MacCutchan13-May-12 22:48
mveRichard MacCutchan13-May-12 22:48 
AnswerRe: Devshock.Net Pin
Midnight Ahri13-May-12 23:52
Midnight Ahri13-May-12 23:52 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:05
mveRichard MacCutchan14-May-12 0:05 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:19
mveRichard MacCutchan14-May-12 0:19 
GeneralRe: Devshock.Net Pin
Luc Pattyn14-May-12 0:52
sitebuilderLuc Pattyn14-May-12 0:52 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:56
mveRichard MacCutchan14-May-12 0:56 

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.