0

Hi guys! I am having trouble debugging these codes. I tried putting "New" keyword in declaring the image variables. Can anyone help me please? I'm creating an RPG game

Dim picf(), picl(), picr(), picb() As Image 'Main problem: when I put "New" keyword it says I                       'cannot use it when declaring an array
    Private Sub frmWalk_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.Right Then
            num = num + 1
            PictureBox1.Image = picf(num)
            If num = 3 Then
                num = 0
            End If
        End If
    End Sub
    Private Sub frmWalk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        picf(1) = f1.Image 'this is problem
        picf(2) = f2.Image
        picf(3) = f3.Image

Edited by alfredo11: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Luc001
0

Hi guys! I am having trouble debugging these codes. I tried putting "New" keyword in declaring the image variables. Can anyone help me please? I'm creating an RPG game

Dim picf(), picl(), picr(), picb() As Image 'Main problem: when I put "New" keyword it says I                       'cannot use it when declaring an array
    Private Sub frmWalk_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.Right Then
            num = num + 1
            PictureBox1.Image = picf(num)
            If num = 3 Then
                num = 0
            End If
        End If
    End Sub
    Private Sub frmWalk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        picf(1) = f1.Image 'this is problem
        picf(2) = f2.Image
        picf(3) = f3.Image

OK I answered my own problem. Thank you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.