Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to change the name of a control using thing.name=

Status
Not open for further replies.

aspro

Programmer
Jan 22, 2003
69
AU
Hi
I want to chnage the name of a group box during a procedure call in my code. I tried using groupbox.name="newname" but it made no difference when I stopped debugging. Can anyone help please?

Many thanks,
aspro
 
When you stop the program and go back to desing mode the name will be what ever you gave it when you placed it. I know of no way to make it perminant short of designing a new control to do just that. And I have no idea if it could even be done.



Becca

Somtimes, the easy answer is the hardest to find. :)
 
well thanks for the help anyway.
i guess i will need to find an alternative method
nevermind :)
many thanks
aspro
 
I am always learning new things, so will keep my eyes and ears open :)


Becca

Somtimes, the easy answer is the hardest to find. :)
 
What is the end result you are trying to achive. There is probablly another way of acomplishing what you are to code. Give some more detail so we can help

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
I have a form that has 4 group boxes in it with exactly the same contents (a whole lot of text boxes) To the user it seems as though each box is a new subform in which to enter the details of a person into.

I encountered problems when a user wants to delete a gb after filling out the other boxes after it.
the maximum subforms to fill out is four so they fill out each gb in order however i allow them to go back and forward using the next and previous buttons below.

I wanted to, if they deleted a gb that was not the last one, swap the name of the deleted one to that of the last gb so that, while navagating through the 4 gb i could simply make the last one (or however many they deleted) not visible and they would only see the ones that were active and not still press next on a gb that they supposdly deleted.

Well done if u can actually understand my explaination :)

Many thanks,
aspro
 
You cant change the name while the program is running but you can create a new object with a different name that points to the same reference in memory. But first I want to understand what you are doing.

What are you using the GroupBox name for. Are you adding the data into a DB using the Name as a key?

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Yes thats exactly right, it will all go into the DB after this.
 
Unlike VB6, you CAN change the Name of a form or control while running BUT, the NAME property has no meaning after compilation.
"Control.Name Property
See Also
Control Class | Control Members | System.Windows.Forms Namespace | ISite.Name | Control Members (Visual J# Syntax)

Visual Basic
Gets or sets the name of the control.



Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top