I admit that I do know how to use Visual Basic..?LetsRaceBwoi, do you want to admit something? Something ALL of us should know about? Hmmm?
Anyways, XNA vs Windows Forms, XNA. God forbid something turn out as horrible as TSOEmu True.
Spooky.I already sort of know, Ianbow, I'm just letting it slide for now.
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation = My.Settings.animation + 1
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
My.Settings.animation = 0
Do Until My.Settings.animation = 4
If My.Settings.animation = 1 Then
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
Else
If My.Settings.animation = 2 Then
PictureBox1.Hide()
PictureBox2.Show()
PictureBox3.Hide()
Else
If My.Settings.animation = 3 Then
PictureBox1.Hide()
PictureBox2.Hide()
PictureBox3.Show()
End If
End If
End If
Loop
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
End Sub
End Class
You should put your code in a CODE tag!Hi!
So i'mm still learning Visual Basic 'cause i want to learn that first before XNA. And it' going pretty good! But now i want to make a simple animation with pictureboxes. So i used this code:
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation = My.Settings.animation + 1
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
My.Settings.animation = 0
Do Until My.Settings.animation = 4
If My.Settings.animation = 1 Then
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
Else
If My.Settings.animation = 2 Then
PictureBox1.Hide()
PictureBox2.Show()
PictureBox3.Hide()
Else
If My.Settings.animation = 3 Then
PictureBox1.Hide()
PictureBox2.Hide()
PictureBox3.Show()
End If
End If
End If
Loop
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
End Sub
End Class
But when I click on the button, the whole program stops working :s, it's probably a stupid mistake I made, could someone tell me what I did wrong? Thanks!
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation = My.Settings.animation + 1
End Sub
Timer1.Enabled doesn't start it AFAIK. Use Timer1.Start() - that always works for me.Sorry! changed it!
But in the first lines there is written that each tick my.settings.animation is my.settings.animations + 1, so i do add on it?
Code:Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick My.Settings.animation = My.Settings.animation + 1 End Sub
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation = My.Settings.animation + 1
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
My.Settings.animation = 0
Do Until My.Settings.animation = 4
If My.Settings.animation = 1 Then
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
Else
If My.Settings.animation = 2 Then
PictureBox1.Hide()
PictureBox2.Show()
PictureBox3.Hide()
Else
If My.Settings.animation = 3 Then
PictureBox1.Hide()
PictureBox2.Hide()
PictureBox3.Show()
End If
End If
End If
Loop
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
End Sub
End Class
There appears to be nothing wrong with your code.Nope, it still crashes :/
So this is my code now, 3 pictureboxes and the interval is 200
Code:Public Class Form1 Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick My.Settings.animation = My.Settings.animation + 1 End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Timer1.Start() My.Settings.animation = 0 Do Until My.Settings.animation = 4 If My.Settings.animation = 1 Then PictureBox1.Show() PictureBox2.Hide() PictureBox3.Hide() Else If My.Settings.animation = 2 Then PictureBox1.Hide() PictureBox2.Show() PictureBox3.Hide() Else If My.Settings.animation = 3 Then PictureBox1.Hide() PictureBox2.Hide() PictureBox3.Show() End If End If End If Loop End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load PictureBox1.Show() PictureBox2.Hide() PictureBox3.Hide() End Sub End Class
I'll run the code myself when I get home. If you want you can zip the solution and send it but I don't necessarily need it.But it still crashes! Do you really have no idea? :s
Your code busy loops, meaning that it will loop forever until another thread sets "My.Settings.animation" to 4. The timer element runs on the UI thread with everything else, so it'll never happen as the UI thread is stuck in the busy loop. (not that this was a good idea in the first place, since it'll slam your cpu either way)Nope, it still crashes :/
So this is my code now, 3 pictureboxes and the interval is 200
Code:Public Class Form1 Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick My.Settings.animation = My.Settings.animation + 1 End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Timer1.Start() My.Settings.animation = 0 Do Until My.Settings.animation = 4 If My.Settings.animation = 1 Then PictureBox1.Show() PictureBox2.Hide() PictureBox3.Hide() Else If My.Settings.animation = 2 Then PictureBox1.Hide() PictureBox2.Show() PictureBox3.Hide() Else If My.Settings.animation = 3 Then PictureBox1.Hide() PictureBox2.Hide() PictureBox3.Show() End If End If End If Loop End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load PictureBox1.Show() PictureBox2.Hide() PictureBox3.Hide() End Sub End Class
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation += 1
Select Case My.Settings.animation
Case 1
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
Case 2
PictureBox1.Hide()
PictureBox2.Show()
PictureBox3.Hide()
Case 3
PictureBox1.Hide()
PictureBox2.Hide()
PictureBox3.Show()
Case Else
Timer1.Stop()
// set state for future
End Select
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
My.Settings.animation = 0
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.Show()
PictureBox2.Hide()
PictureBox3.Hide()
End Sub
End Class
>.>There appears to be nothing wrong with your code.
A 6 inch phone, it's tinyI read it on my phone and saw the problem, that's not really an excuse.
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
My.Settings.animation += 1
Select Case My.Settings.animation
Case 1
PictureBox1.Image = My.Resources.BurbyKitchen1
Case 2
PictureBox1.Image = My.Resources.BurbyKitchen2
Case 3
PictureBox1.Image = My.Resources.BurbyKitchen3
Case 4
PictureBox1.Image = My.Resources.BurbyKitchen4
Case 5
PictureBox1.Image = My.Resources.BurbyKitchen5
Case 6
PictureBox1.Image = My.Resources.BurbyKitchen6
Case 7
PictureBox1.Image = My.Resources.BurbyKitchen7
Case 8
PictureBox1.Image = My.Resources.BurbyKitchen8
Case 9
PictureBox1.Image = My.Resources.BurbyKitchen9
Case 10
PictureBox1.Image = My.Resources.BurbyKitchen10
Case 11
PictureBox1.Image = My.Resources.BurbyKitchen11
Case 12
PictureBox1.Image = My.Resources.BurbyKitchen12
Case 13
PictureBox1.Image = My.Resources.BurbyKitchen13
Case 14
PictureBox1.Image = My.Resources.BurbyKitchen14
Case 15
PictureBox1.Image = My.Resources.BurbyKitchen15
Case 16
PictureBox1.Image = My.Resources.BurbyKitchen16
Case 17
PictureBox1.Image = My.Resources.BurbyKitchen17
Case 18
PictureBox1.Image = My.Resources.BurbyKitchen15
Case 19
PictureBox1.Image = My.Resources.BurbyKitchen16
Case 20
PictureBox1.Image = My.Resources.BurbyKitchen17
Case 21
PictureBox1.Image = My.Resources.BurbyKitchen15
Case 22
PictureBox1.Image = My.Resources.BurbyKitchen16
Case 23
PictureBox1.Image = My.Resources.BurbyKitchen17
Case 24
PictureBox1.Image = My.Resources.BurbyKitchen15
Case 25
PictureBox1.Image = My.Resources.BurbyKitchen16
Case 26
PictureBox1.Image = My.Resources.BurbyKitchen17
Case Else
Timer1.Stop()
End Select
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
My.Settings.animation = 0
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.Show()
End Sub
Private Sub PictureBox2_Click(sender As Object, e As EventArgs)
End Sub
End Class
How do you live?The iPhone 5 has a 4 inch screen. I'm not sure why this is relevant.