Quick Method to create/rename a group of textboxes?

lotuseater

Member
Joined
Mar 31, 2009
Messages
5
Programming Experience
1-3
I would like to create or rename a group of sequential textboxes on my VB.NET windows form in the design environment.
I currently have 70 textboxes. Right now they are named as TextBox1...TextBox70. I would like to rename all of them to something else like Conveyor1...Conveyor70.
I am going to have other groups of textboxes on the screen as well, so I need a quick method to either create them with another sequential name or rename the entire group.

Thank you for any help.
 
You should look into creating VS macros. There's nothing in VS that will do that for you but VS is highly extensible and customisable, so you can code it yourself.
 
Are your renaming all the textboxes currently on your form? You can use the Find & Replace dialog window to do this for you but you will have to run it a few times with a few different key word searchs. Select the "Show All Files" icon in the solution explorer and under your form, double click on "yourForm".Designer.vb. There are some places in the form where the word TextBox needs to remain named exactly so, so do not do your replace soley on the word textbox.

Use the Find & Replace to look for:

01) Me.TextBox >> Replace with Me.Conveyor
02) .Name = "TextBox >> Replace with .Name = "Conveyor
03) Friend WithEvents TextBox >> Replace with Friend WithEvents Conveyor

04) In the code window of your form, you must also convert any existing textbox events that are shown in coding and any spot you coded the name of your textboxes.
 
Last edited:
Tom - That worked great for me. Thank You!

jmcilhinney - I may see if I can figure out how to record a macro to do it for me next time. I am not very familiar with macros in the .net designer yet.
 
Back
Top