Mass renaming of control names question

ElderKain

New member
Joined
Jan 16, 2011
Messages
4
Location
Council Bluffs, Iowa
Programming Experience
1-3
I'm making an art program involving 8x8 squares on a grid, but there are 64x64 grid square PictureBoxes for each grid square. Meaning there are 4096 picturebox squares to be setup.

I'm having them names like pic0001, pic0002, pic0003, etc... but re-naming them individually would take me forever.

Is there a way to mass re-name them at once?

:confused:
 
I'm not sure about the lil specifics of your application but wouldn't be easier to create them via code (with whatever name you want) and add to a 'List of'?
 
As said above, you should be able to create the objects at runtime and then add them to your form, maybe use something like TableLayoutPanel?

You could try something like: (I have not tested this code)

VB.NET:
Dim ObjectArray as new arraylist

For i =0 to 10  'for example

     Dim myPictureBoxObject as new system.windows.forms.picturebox     ' check this

     ObjectArray.add(myPictureBoxObject)



next



'now you can manipulate the objects

Form1.TableLayoutPanel1.Controls.Add(ObjectArray.items(0))


I just stuck that code together, so it may not work properly, but the idea was to define objects in an arraylist, and then 'add' those objects from the arraylist to the table.

Optionally you can add them to the form like

ObjectArray.items(0).location = new system.drawing.point(10,10) ' x,y in px i think
 
That's not what I'm wanting though. I have already placed all the picture boxes visually.
I was just wondering if there was a way to mass rename them all at once instead of individually one by one.
Also all the pictureboxes are in a panel object for easy placements.
 
That's not what I'm wanting though. I have already placed all the picture boxes visually.
I was just wondering if there was a way to mass rename them all at once instead of individually one by one.
Also all the pictureboxes are in a panel object for easy placements.

hi...
on a second thought....

depending how 'standardized' are the current controls... you'll probably be able to close visual studio, go to your project folder in your computer, open with notepad the FormName.Resources.vb and find and replace functions there... and then repeat the process for the FormName.vb... it might work.

make sure to have a backup of the project if case it completely screws it up..
 
hi...
on a second thought....

depending how 'standardized' are the current controls... you'll probably be able to close visual studio, go to your project folder in your computer, open with notepad the FormName.Resources.vb and find and replace functions there... and then repeat the process for the FormName.vb... it might work.

make sure to have a backup of the project if case it completely screws it up..

I looked that up and found out all that was in
frmClothArt.Designer.vb but the numbers of the parts are all out of order, and there are like multiple instances of the same object names to be renamed throughout the entire file.
It would be quicker to manually rename each picturebox name individually.
I guess I'm gonna have to take the long way of rename each picturebox object's file manually >.<
 
I looked that up and found out all that was in
frmClothArt.Designer.vb but the numbers of the parts are all out of order, and there are like multiple instances of the same object names to be renamed throughout the entire file.
It would be quicker to manually rename each picturebox name individually.
I guess I'm gonna have to take the long way of rename each picturebox object's file manually >.<

oh yes FormName.Designer.vb ... my bad... I do vb at work only, was trying to remember from heart.
 
but yea, I'm just gonna have to the long arduous task of manually renaming all the picturebox object names.
gonna take me forever, lol.
 
Back
Top