vb.net - Tracking Controls via an Array -
Then I have an array in which there are snap boxes. Can someone help me in coding in a more efficient, more efficient way of specifying each indicator? I just can not figure it out
Arrybullets (0) = Pikbult0 ArrayBullets (1) = Pikbultl ArrayBullets (2) = Pikbult2 ArrayBullets (3) = Pikbult3 ArrayBullets (4) = Pikbult4 ArrayBullets (5) = Pikbult5 ArrayBullets (6) = PicBullet6 ArrayBullets (7) = picBullet7 ArrayBullets (8) = picBullet8 ArrayBullets (9) = picBullet9 ArrayBullets (10) = picBullet10 ArrayBullets (11) = picBullet11 ArrayBullets (12) = picBullet12 ArrayBullets (13) = PicBullet13 ArrayBullets (14) = picBullet14 ArrayBullets (15) = picBullet15 ArrayBullets (16) = picBullet16 ArrayBullets (17) = picBullet17 ArrayBullets (18) = picBullet18 ArrayBullets (19) = picBullet19 ArrayBullets (20) = picBullet20 ArrayBullets (21) = picBullet21 ArrayBullets (22) = picBullet22 ArrayBullets ( 23) = Pikbult23 ArrayBullets (24) = Pikbult24 ArrayBullets (25) = Pikbult25 ArrayBullets (26) = Pikbult26 ArrayBullets (27) = Pikbulle T27 ArrayBullets (28) = Pikbult28 ArrayBullets (29) = Pikbult29
< P> This multi Would be appreciated. There is usually no reason to do this. They are always found in the If you need to track a reference instead of storing it, you can use a Method one - Add names to form loads: Method two - with control in the form load Get the name To do something with a special Punjab: clear all images: Delete: archive collection
(you will not find them in between the component
). Although this order seems to have been ordered, your list is actually a bit arbitrary; They will always be in the control collection in the order that the designer starts as an added order and may or may not make any difference. list (string) to store your names in the control archive to refer them to < Use / code>. If any control reference is somehow important, then
list (of the picture box)
can be used instead.
Private myPicBoxes new list (as a string)
As integer = 0 to 29 myPicBoxes.Add (string.format ("picbulate {0}", n. Ostrate)) Next n
for each PB in my PictureBox form. Control. Opti Type (from PictureBox) mypicBoxes.Add (pb.Name) Next
Me.Controls (myPicBoxes (mypicBoxes (theIndex))) .Image = filename
each pbName string
myPicBoxes Me.Controls In (for pbName) .image = nothing is next 'or for integer as n = 0 myPicBoxes.Count- 1 Me.Controls (myPicBoxes (n)). Image = nothing next if they are dynamic (you remove or add movie runtime) Add / Remove T in your lis as well: < Pre>
as a slow pb new picture box ... set support pb.Name = whatever you want my picboxes.Add (pb.Name) me.Controls.Add (pb)
< / Div> Me.Controls.Remove (mypicBoxes (n)) mypicBoxes.RemoveAt (n) 'also remove the name from your tracker