[RESOLVED] re-order control array??
hey , guys ....
another control array problem :)
I have control array of pictures
let's say
Quote:
pic(0)
pic(1)
pic(2)
pic(3)
pic(4)
pic(5)
pic(6)
user can delete any of those in run-time ... so if he deletes pic(3) then we have :
Quote:
pic(0)
pic(1)
pic(2)
pic(4)
pic(5)
pic(6)
the problem is that I want these array to re-order itself to become
Quote:
pic(0)
pic(1)
pic(2)
pic(3)
pic(4)
pic(5)
Am I make sense??? and if I do , Is that possible to make???
thanks in advance
Re: re-order control array??
with other controls it easier than a picturebox or image control
you would need add a control to replace the deleted one, then loop through all the controls from the new one, in this case 3 to 5 and copy the all the required properties form the one above probably have to copy top,left,height,width,picture,image,font (all properties), autoredraw, maybe someothers, any that are default from creation should not need changing
Re: re-order control array??
so , isn't won't work with picturebox ??
Re: re-order control array??
yes it work for picturebox, just more properties to copy, especially if pictureboxes have different sized pictures or images
Re: re-order control array??
thanks for helping , I will try it :)
Re: re-order control array??
Is there a particular reason that you want the numbers to not have any gaps?
If it is just so that you can loop thru them, it doesn't matter about the gaps - just use a For Each loop, eg:
Code:
Dim objPic as PictureBox
For Each objPic In pic
objPic.Cls
objPic.Print "hello!"
Next objPic
1 Attachment(s)
Re: re-order control array??
ok , here is the thing , I use vsflexgrid for layers , every layer has it's properties , and within : the color
like picture below
ok , I make control array on picturebox , so when user press new layer button , new layer will be added with editable colorful picturebox , the thing is when user delete current layer ... there will be one more picturebox than the already rows I have
I hope I was clear enough
Re: re-order control array??
In that case it makes sense.
One minor thing, rather than removing and re-adding, I would recommend that you remove the last picturebox instead, then update the properties as apt for the ones down to the 'removed' one.
Re: re-order control array??
that's good call ... I should give it shot , thanks .. :)
Re: [RESOLVED] re-order control array??
thanks for help , guys , and si_the_geek , it worked that way , thanks for helping