mendez
mendez

Reputation: 327

How do you change the title or name of form1 in C#

I have a quick question. how do I change the name of form1 in my app? whenever I try to use the properties to rename it the form becomes broken and i cant use it anymore. is there a way to change it during run-time or am i doing something wrong with the properties? thanks.

Upvotes: 7

Views: 64550

Answers (6)

foxy
foxy

Reputation: 7672

Change the Text property of your form under the Properties panel, making sure that you've selected the form itself (and not some child control)

enter image description here

Upvotes: 8

Gaurav
Gaurav

Reputation: 840

You can use Form.Text property to get/set the title of the form either in design time or at runtime depending upon your requirement. If you want to have a dynamic title that changes based on some events you can set it during the runtime for e.g. if you are showing the progress of a task in your form you will want to put the percentage completed in the title.

Upvotes: 1

user807566
user807566

Reputation: 2866

If you want to change the text of the window during runtime, use the Text property:

this.Text = "Title";

Upvotes: 18

Only Bolivian Here
Only Bolivian Here

Reputation: 36733

To change the name of your form, select it in the solution explorer and press F2. Then type in the new name for that form (don't forget the '.cs'!) and when you press enter it'll ask you if you want Visual Studio to update all references to that form. Click Yes, and you're done.

Upvotes: 1

SoftwareGeek
SoftwareGeek

Reputation: 15762

I believe you can just change the filename of the form to the one you want in design time.

Upvotes: 0

Related Questions