|
-
Jan 28th, 2012, 09:39 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] about button name
if i have a form with 100 button and i want to rename them all in sequence like
btn0,btn1 ....
is there a way to do this in code or i have to do it manualy
-
Jan 28th, 2012, 09:50 AM
#2
Re: about button name
You need to do this manually.
-
Jan 28th, 2012, 09:58 AM
#3
Thread Starter
Fanatic Member
Re: about button name
is there any easy way to do it than name it button by button
-
Jan 28th, 2012, 09:59 AM
#4
Hyperactive Member
Re: about button name
At runtime, you'll have to do it manually as kevin said.
vbnet Code:
Dim btn As Button For i As Int32 = 0 to 99 btn = New Button() btn.Name = "Button" & i.ToString() btn.Size = New Size(0, 0) btn.Location = New Point(x,y) [control].Controls.Add(btn) Next
etc etc.. You'll have to calculate where the buttons go though, which generally isn't to difficult. Just so long as there uniform.
-
Jan 28th, 2012, 10:05 AM
#5
Addicted Member
Re: about button name
You can do that at runtime iterating form's control collection using GetType to identify your buttons.
-
Jan 28th, 2012, 10:41 AM
#6
Re: about button name
 Originally Posted by new1
is there any easy way to do it than name it button by button
If you had MZ-Tools (third party IDE add-in) you could do it easily. In short the add-in has a control assistant which looks like

which allows you to change the name, press enter move down to the next control until done. Pressing Enter updates the control name.
Side note: There are a good deal of nice features in this tool but my most used is their tab assistant and enhanced find dialog. Been using this tool for the past five or six year and has easily paid for itself (50 dollars when we purchased it) many times over.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|