VS 2008 add picturebox during runtime and loading image into picturebox-VBForums
Results 1 to 6 of 6

Thread: add picturebox during runtime and loading image into picturebox

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    14

    add picturebox during runtime and loading image into picturebox

    i'm doing a simple form tat could add picturebox during runtime and i could add several picture into it. is thr any simple solution for this matter?

  2. #2
    vb Coda .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    18,742

    Re: add picturebox during runtime and loading image into picturebox

    vb Code:
    1. dim pb as new picturebox
    2. pb.location = new point(50,50)
    3. pb.sizemode = autosize 'check this
    4. pb.image = new bitmap(filename)
    5. me.controls.add(pb)

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    14

    Re: add picturebox during runtime and loading image into picturebox

    hi paul, i gt a bit blur.. can u giv me de full coding.. stil cant figure out hw it works? sry if my question was silly..

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    14

    Re: add picturebox during runtime and loading image into picturebox

    vb Code:
    1. Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
    2.         Dim pb As New PictureBox
    3.         pb.Location = New Point(50, 50)
    4.         pb.SizeMode = AutoSize 'check this
    5.         pb.Image = New Bitmap(filename)
    6.         Me.Controls.Add(pb)
    7.     End Sub

    i put it like tis.. i dunno y gt error.. name "filename" is nt declare.. but i dy declare it..

  5. #5
    vb Coda .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    18,742

    Re: add picturebox during runtime and loading image into picturebox

    pb.Image = New Bitmap("c:\aValidFilename.bmp")

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    14

    Re: add picturebox during runtime and loading image into picturebox

    hey paul..

    i changed de code dy.. but dun hv picturebox appear at my richtextbox thr.. and whn i add pic into it de pic bcum blur after i drag it into smaller size.. can u tel me wat de prob?

    thx..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.