Moving Image to the next form with same image

John Paul Sim
John Paul Sim used Ask the Experts™
on
I would like may image like same as it from the next but I don't no how please I will need help

form1 code
Public Class form1
    Dim images(49) As Bitmap
    Dim pos As Integer = 0
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Me.Close()
    End Sub

    Private Sub Form6_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        images(0) = WindowsApplication1.My.Resources.B1
        images(1) = WindowsApplication1.My.Resources.B2
        images(2) = WindowsApplication1.My.Resources.B3
        images(3) = WindowsApplication1.My.Resources.B4
        images(4) = WindowsApplication1.My.Resources.B5
        images(5) = WindowsApplication1.My.Resources.B6
        images(6) = WindowsApplication1.My.Resources.B7
        images(7) = WindowsApplication1.My.Resources.B8
        images(8) = WindowsApplication1.My.Resources.B9
        images(9) = WindowsApplication1.My.Resources.B10
        images(10) = WindowsApplication1.My.Resources.B11
        images(11) = WindowsApplication1.My.Resources.B12
        images(12) = WindowsApplication1.My.Resources.B13
        images(13) = WindowsApplication1.My.Resources.B14
        images(14) = WindowsApplication1.My.Resources.B15
        images(15) = WindowsApplication1.My.Resources.B16
        images(16) = WindowsApplication1.My.Resources.B17
        images(17) = WindowsApplication1.My.Resources.B18
        images(18) = WindowsApplication1.My.Resources.B19
        images(19) = WindowsApplication1.My.Resources.B20

        PictureBox1.Image = images(pos)
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        pos = pos + 1
        If pos <= 19 Then
            PictureBox1.Image = images(pos)
            Button3.Enabled = True
        Else
            pos = 19
            Button2.Enabled = False
        End If
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        pos = pos - 1
        If pos >= 0 Then
            PictureBox1.Image = images(pos)
            Button2.Enabled = True
        Else
            pos = 0
            Button3.Enabled = False
        End If
    End Sub
End Class

form2 code

??
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
"I would like may image like same as it from the next but I don't no how please I will need help "

You're going to have to be more SPECIFIC here.  What exactly are you trying to achieve?  Which part works, and which part doesn't?  I ~think~ you're trying to do something with Form2, but I'm really not sure...
Senior .Net Developer
Commented:
I would just create a global variable for your image array.  Handle the loading in main before the application run and reference the array in both forms.
Kyle AbrahamsSenior .Net Developer

Commented:
Auto close.  Suggested refactoring for simplification that can be referenced across multiple forms.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial