Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi guys, i'm new here, i just tryin to create a simple form which i use it to view picture in a picture.. but i seem to have some prob with the coding for the displaying of image.. can someone help me pls.

 

Imports System.Drawing

Public Class Form2
   Inherits System.Windows.Forms.Form
   Friend WithEvents btnClose As System.Windows.Forms.Button
   Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox

   Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
       Dim firstform As New Form1
       Dim secondform As New Form2
       firstform = New Form1
       firstform.Show()
       Me.Close()
   End Sub


   Private Sub PictureBox1_ParentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.ParentChanged
       
      Me.PictureBox1.Image = New Bitmap("C:\MyImage.bmp")

End Sub

End Class

  • Administrators
Posted

Not entirely sure what you are trying to do here. What are each of the forms for in the above code?

Also I notice you create a new instance of Form2 from within Form2 and never use it while also assigning 2 new instances of Form1 to firstform.

 

If you just want to display a picture in a picturebox you could put the line

Me.PictureBox1.Image = New Bitmap("C:\MyImage.bmp")

into the Form's load event and it should display correctly.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...