Hello !
I try to switch from VB6 to VB.NET.
For now I use 2008 Express Edition.
Look at this code, please:
When I run the form, first I click the cmdPlayMovie button.
Then I try to exit by clicking the cmdStopMovie button (in order to set the StopMovie variable to TRUE).
And here is the problem:
At the first click, nothing happen. The cmdStopMovie button seems to take the focus.
Then, at the second click, the "Stopped by user" message appear.
For my project is strongly necessary to stop the movie at a certain frame.
That means that cmdStopMovie button must react at the first click.
Is there a bug or there are some settings to do ?
Hope I have explained well my problem.
More one question (If necessary I'll start a new thread for this).
The WHILE clause seems to have no effect in Do-Loop cycle. So this cycle run for ever (except if I click the cmdStopMovie button).
Can someone understand (and explain) WHY ?
Thank you !
I try to switch from VB6 to VB.NET.
For now I use 2008 Express Edition.
Look at this code, please:
Code:
Public Class frmMovieBuild
Dim StopMovie As Boolean
Private Sub cmdPlayMovie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPlayMovie.Click
StopMovie = False
Dim i As Long, jpg As String
i = 0
Do While i <= lstMainMovie.Items.Count - 1
System.Windows.Forms.Application.DoEvents()
jpg = lstMainMovie.Items.Item(i).ToString
System.Windows.Forms.Application.DoEvents()
pic_MoviePreview.Image = Image.FromFile(jpg)
System.Windows.Forms.Application.DoEvents()
If StopMovie Then
MsgBox("Stopped by user")
Exit Do
End If
i = i + StepFrames.Value 'Here I use a slider control
Loop
End Sub
Private Sub cmdStopMovie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStopMovie.Click
StopMovie = True
End Sub
End Class
Then I try to exit by clicking the cmdStopMovie button (in order to set the StopMovie variable to TRUE).
And here is the problem:
At the first click, nothing happen. The cmdStopMovie button seems to take the focus.
Then, at the second click, the "Stopped by user" message appear.
For my project is strongly necessary to stop the movie at a certain frame.
That means that cmdStopMovie button must react at the first click.
Is there a bug or there are some settings to do ?
Hope I have explained well my problem.
More one question (If necessary I'll start a new thread for this).
The WHILE clause seems to have no effect in Do-Loop cycle. So this cycle run for ever (except if I click the cmdStopMovie button).
Can someone understand (and explain) WHY ?
Thank you !
Comment