Reputation:
hi I want to make a code in separate class that change the title of a form in c#.
public static void Set_Tilte(string title)
{
Form1 f = new Form1();
f.Text = "";
}
and call the method set_title and give a string to it to change the title of form .
note : the method set_title("") is not in the same class it's in separate class .
Upvotes: 1
Views: 477
Reputation: 133403
I would suggest you to pass Form
as parameter, like
public static void Set_Tilte(Form f, string title)
{
f.Text = title;
}
Upvotes: 1