multiple .cs files using shared method, using form name as a parameter
Take a look at this basic example:
public static void headbar(string formname, string heading)
{
string oldheading;
oldheading=formname.Text;
formname.Text=oldheading+" "+heading;
}
Then when I initiate a form (say "myform"), I would:
headbar("myform","testing");
The intended functionality here is to have this common method be used to add verbiage to the .Text property of a form, where I'm providing the form name as a parameter. (There is a 'bigger' issue at stake, but this simple example illustrates what I don't know how to accomplish). The code above won't compile, because "Text" is not a property of the string variable "formname". But the contents of "formname" would have a "Text" property. How would I change my code above to work as intended?