anodize Posted June 16, 2005 Posted June 16, 2005 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 Quote
Administrators PlausiblyDamp Posted June 16, 2005 Administrators Posted June 16, 2005 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.