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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is this. != WindowsApplication1.Form1. ?

Status
Not open for further replies.

wimmer5

Programmer
Feb 13, 2003
1
DE
Hi.

Im trying to rename a Window, by adressing a specific window.

eg.

WindowsApplication1.Form1.Text = "newName";

that didn't work!

what worked was:

1. System.Windows.Form1.Form.ActiveForm.Text = "newName";
and
2. this.Text = "NewName";

But how can I eg. adress Form2? i don't only want to rename the actual Form.
 
Well, it is like this.
You need a reference to the form you want to change, for example:

void ChangeName(Form formToChangeName, string newName)
{
formToChangeName.Text = newName;
}

The problem is to get the reference. I think that it is possible to get a collection of open forms, but I don't know how.

I hope that this can give you a hint of what to do.

Larsson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top