Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

[RESOLVED] Removing Dynamic controls ?

$
0
0
I have created a form with 2 controls, a panel and a picturebox. In the panel I create picturebox controls to show thumbnails. These can be dragged and dropped on the larger picturebox below, which creates another picturebox control in a second array (where high quality images will be loaded)

I want to be able to remove controls and I am trying this code which I though should remove them all, I want to do it by index in-case I want to remove just one. I have put the number of the control in the .Tag property:
Code:

Dim c As Integer = 0
            For Each pic As PictureBox In PanelImagesLoaded.Controls.OfType(Of PictureBox)()
                For Each childc In pic.Controls
                    If TypeOf childc Is PictureBox Then
                        c = c + 1
                        childc.Controls.Remove()
                        PicBoxArray(c) = Nothing
                        PicBoxLayoutArray(c) = Nothing
                    End If
                Next
            Next
            PanelImagesLoaded.Invalidate()

PanelImagesLoaded is the thumbnail container, can anyone point me to were I am going wrong because this does not unload or remove anything.

Help is greatly appreciated


Name:  dynamic_controls.jpg
Views: 69
Size:  31.0 KB
Attached Images
 

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>