Hi!!
In my project i added 16 images that form a animation. Then i added a form, in which i added a picture box (Circulo) and a Timer (Timer1).
Then i added this code:
With this code when i hit play, the animation in the form works perfectly. But if i add a line like this:Code:Dim ImagemActual As Short = 0 Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim Imagens(15) As Bitmap Imagens(0) = My.Resources.Posicao1 Imagens(1) = My.Resources.Posicao2 Imagens(2) = My.Resources.Posicao3 Imagens(3) = My.Resources.Posicao4 Imagens(4) = My.Resources.Posicao5 Imagens(5) = My.Resources.Posicao6 Imagens(6) = My.Resources.Posicao7 Imagens(7) = My.Resources.Posicao8 Imagens(8) = My.Resources.Posicao9 Imagens(9) = My.Resources.Posicao10 Imagens(10) = My.Resources.Posicao11 Imagens(11) = My.Resources.Posicao12 Imagens(12) = My.Resources.Posicao13 Imagens(13) = My.Resources.Posicao14 Imagens(14) = My.Resources.Posicao15 Imagens(15) = My.Resources.Posicao16 Circulo.Image = Imagens(ImagemActual) Circulo.Update() ImagemActual += 1 If ImagemActual = 15 Then ImagemActual = 0 End Sub
UpdateDB is a Sub that does a lot of stuff (opens a file, then changes a DB according to the file)Code:Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown Timer1.Start() UpdateDB() End Sub
If i add this line he does the intire code of UpdateDB() and then he show ONLY the first image of the animation, like the timer isnt working. Can u help me so that he does the code in UpdateDB() and at the same time he shows the animation. If I put Timer1.Start() at the start of UpdateDB() sub its like it is the last thing he does, has if it as on last.




Reply With Quote