I'm stumped right now, I cannot figure out how to code something to get information from another form.

This is what I'm trying to do:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "01" Then 'TextBox1 is in form 2.
            PictureBox1.Image = System.Drawing.Bitmap.FromFile(My.Application.Info.DirectoryPath & "\Image00001.png") 'PictureBox1 is in form 1.
        ElseIf TextBox1.Text = "02" Then 'TextBox1 is in form 2.
            PictureBox1.Image = System.Drawing.Bitmap.FromFile(My.Application.Info.DirectoryPath & "\Image00002.png") 'PictureBox1 is in form 1.
        End If
    End Sub

When I use that code, it tells me that PictureBox1 is not declared, it's because it's not in the same form as TextBox1 and the button.

I know it's probably extremely simple, but I just can't figure it out.

Hi
Was one of the forms called (or created) in the other?
for example

dim f as new form1
f.show()

If yes, then the "parent" form can access the other forms controls by prefacing it with the form name for example

f.PictureBox1

It should appear in intellisense.
Otherwise you could create a public variable on the form and then assign the value to it through that.
Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.