I have a form, with a lot of settings pages. All the pages are the same, so I would rather just make a single form, and then pass in the name of the setting its supposed to edit. How would I do this? Lets say the form is called "ConfigForm", I want to be able to call it with something like this:
new ConfigForm("event1").Show();
Simple, this pulls up the ConfigForm, and sends the string "event1". However, knowing that I am looking for the setting "event1", how do I now access this setting? Normally to access a setting, I assume I would use something like this: (event1 is a StringCollection)
string varName = Properties.Settings.Default.passedString[3];
How do I put "event1" in a string, when event1 is stored in the variable "passedString"? In PHP, I would use something like EVAL. How would I do it in C#?
---- EDIT
Previous answers have solved the "settings" problem; but it doesn't answer the underlying question. How do you use a string passed along in a variable as a variable identifier? So if I had a string called "passedString", with the text "event1" stored in it... How would I get that to convert:
this.(passedString).Text = "test";
into
this.event1.Text = "test";