J
Jaroslav Jakes
Hi,
imagine having an INI-file with entries like:
# key=Control / value=Text property of control
controlA=bla bla bla
controlB=bla bla bla
controlA and controlB are different controls of types like TextBox, etc.
Closing form will write INI-file, storing control names and text property of
these
Loading form will read INI-file and set text value of corresponding control
quite a simple task, if you'll do it as follows:
.....
switch (iniControl)
{
case "controlA" :
controlA.Text = iniValue;
break;
....
}
....
But what about a more generic solution?
Assuming that the key-value of INI-file is a known control, an instance
within the form, what about a solution like:
- get instance of the control by its name
- set value from INI-file to Text-property
Tried to solve this by using reflection - something like
GetType(iniControl), but never suceeded.
What do you think how this could be solved?
Thanks and regards - Jari
imagine having an INI-file with entries like:
# key=Control / value=Text property of control
controlA=bla bla bla
controlB=bla bla bla
controlA and controlB are different controls of types like TextBox, etc.
Closing form will write INI-file, storing control names and text property of
these
Loading form will read INI-file and set text value of corresponding control
quite a simple task, if you'll do it as follows:
.....
switch (iniControl)
{
case "controlA" :
controlA.Text = iniValue;
break;
....
}
....
But what about a more generic solution?
Assuming that the key-value of INI-file is a known control, an instance
within the form, what about a solution like:
- get instance of the control by its name
- set value from INI-file to Text-property
Tried to solve this by using reflection - something like
GetType(iniControl), but never suceeded.
What do you think how this could be solved?
Thanks and regards - Jari