Hey guys and gals I have been trying to solve a problem with a program that I am creating for about 48 hours now and am Well "Stumped" I'm hoping that someone can share their logic on how to solve this. I will say that I'm by no mean a great programmer and truth only have been programming for a few months so please take that into consideration of there is something very stupid that I am doing.
Here is a screen shot of the interface that I am having trouble with.
Attachment 96933
These are all picture boxes that I am using and assigning images and tags to them from a different part of the program. The goal here is for when a USER double clicks on one of the picture boxes it removes the picture and then sorts the rest of them accordingly. I have created a Sub Routine to handle all the item's removal that does various things like remove the item name from a string etc. This is what I have so far to remove an item and it seems to work great.
So now for the complicated part (well at least for me) If you notice the Attachment 96937 These are just representing that the item's size takes up more then one slot. So when you remove the item these are also removed. The problem is that once an Item has been removed all of the items need to be placed in order. For example, if I remove "picboxMain1" and the following 5 red circle slashes. I need "picboxMain7" and "picboxMain8" to be moved to "picboxMain1" and "picboxMain2".
To be more clear of what I am trying to do is loop through them so that I don't have to write out each picture box 12 times. I know that I could this in a very long hand way but since I am trying to be more efficient in my code I want to loop this.
Thank you all in advance for taking the time to look at my post and any help you may provide.
-Vildez.
Here is a screen shot of the interface that I am having trouble with.
Attachment 96933
These are all picture boxes that I am using and assigning images and tags to them from a different part of the program. The goal here is for when a USER double clicks on one of the picture boxes it removes the picture and then sorts the rest of them accordingly. I have created a Sub Routine to handle all the item's removal that does various things like remove the item name from a string etc. This is what I have so far to remove an item and it seems to work great.
Code:
Private Sub RemoveItem(sender as Object, e as EventArgs) Handles picboxMain1.doubleclick ..........(all the Picture Boxes here)
If Not Ctype(sender,picturebox).image is nothing then
Ctype(sender,picturebox).image = nothing
End If
To be more clear of what I am trying to do is loop through them so that I don't have to write out each picture box 12 times. I know that I could this in a very long hand way but since I am trying to be more efficient in my code I want to loop this.
Thank you all in advance for taking the time to look at my post and any help you may provide.
-Vildez.