• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 63
  • Last Modified:

Moving Image to the next form with same image

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

??
0
John Paul Sim
Asked:
John Paul Sim
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
"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...
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
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.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Auto close.  Suggested refactoring for simplification that can be referenced across multiple forms.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now