Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Removing a Picture Box

Removing a Picture Box

Scheduled Pinned Locked Moved Visual Basic
questiondatabasedata-structurestutorialannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Klazen
    wrote on last edited by
    #1

    I have a subroutine that creates new pictureboxes when a user clicks a button. Here is a condensed version:

        ReDim Preserve Picbox(array\_size)
        For index As Integer = 0 To array\_size
            Picbox(index) = New PictureBox
        Next
        For index As Integer = 0 To array\_size
            Me.Controls.Add(Picbox(index))
            Picbox(index).Image = blip
        Next
    

    Now, I need to know how to be able to remove a picturebox, or otherwise manipulate the new pictureboxes. When I modify/erase pictures in the array, nothing happens to the pictureboxes on the form. How can I manipulate these new pictureboxes?

    J 1 Reply Last reply
    0
    • K Klazen

      I have a subroutine that creates new pictureboxes when a user clicks a button. Here is a condensed version:

          ReDim Preserve Picbox(array\_size)
          For index As Integer = 0 To array\_size
              Picbox(index) = New PictureBox
          Next
          For index As Integer = 0 To array\_size
              Me.Controls.Add(Picbox(index))
              Picbox(index).Image = blip
          Next
      

      Now, I need to know how to be able to remove a picturebox, or otherwise manipulate the new pictureboxes. When I modify/erase pictures in the array, nothing happens to the pictureboxes on the form. How can I manipulate these new pictureboxes?

      J Offline
      J Offline
      JUNEYT
      wrote on last edited by
      #2

      If you want to remove a specific picturebox according to your code, use dispose method as shown below. Picbox(index).dispose I think that should work! :wtf:

      What a curious mind needs to discover knowledge is noting else than a pin-hole.

      K 1 Reply Last reply
      0
      • J JUNEYT

        If you want to remove a specific picturebox according to your code, use dispose method as shown below. Picbox(index).dispose I think that should work! :wtf:

        What a curious mind needs to discover knowledge is noting else than a pin-hole.

        K Offline
        K Offline
        Klazen
        wrote on last edited by
        #3

        That does not work. The pictureboxes remain on the form.

        J 1 Reply Last reply
        0
        • K Klazen

          That does not work. The pictureboxes remain on the form.

          J Offline
          J Offline
          JUNEYT
          wrote on last edited by
          #4

          Try Me.Controls.remove(Picturebox name goes here)... :wtf:

          What a curious mind needs to discover knowledge is noting else than a pin-hole.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups