C
Chicken15
Hi Group.
First of all I'm sorry for asking (maybe) such easy questions. But I'm
quite stuck now and couldn't come up with a solution by using my C#
book or googling. So it would be nice if someone could help me out.
Now first of all I want to describe the setting in a simpler (I'm using
Visual Studio 2005):
Form: One comboBox (dropdown list) and 2 buttons.
Classes: Class1 with a function do() which plainly returns a string.
Ok, what do I want to do with these?
The comboBox should show all current instances of Class1 (even if some
are instanced at runtime).
Button1 should create a new instance of Class1 with a fixed
instancename + a number (e.g. there is a string with the value
"testclass" and an increasing integer "i". Instances should be created
with a name combined from both -> string+integer -> testclass1 ,
testclass2 etc.)
Button2 should call a function from the currently in the comboBox
selected class. (e.g. "testclass2" is selected in the list -> click
calls "testclass2.do()" )
So my problems with this setting are:
- Is it possible in any way to instance a class with a name combined of
string and an integer? Maybe with some kind of boxing?
- Keeping the comboBox updated. Maybe ILists are the way to go here?
- Calling functions of the currently selected class in the comboBox.
Hope it gets clear with this explanation.
Thanks alot.
Jürgen
First of all I'm sorry for asking (maybe) such easy questions. But I'm
quite stuck now and couldn't come up with a solution by using my C#
book or googling. So it would be nice if someone could help me out.
Now first of all I want to describe the setting in a simpler (I'm using
Visual Studio 2005):
Form: One comboBox (dropdown list) and 2 buttons.
Classes: Class1 with a function do() which plainly returns a string.
Ok, what do I want to do with these?
The comboBox should show all current instances of Class1 (even if some
are instanced at runtime).
Button1 should create a new instance of Class1 with a fixed
instancename + a number (e.g. there is a string with the value
"testclass" and an increasing integer "i". Instances should be created
with a name combined from both -> string+integer -> testclass1 ,
testclass2 etc.)
Button2 should call a function from the currently in the comboBox
selected class. (e.g. "testclass2" is selected in the list -> click
calls "testclass2.do()" )
So my problems with this setting are:
- Is it possible in any way to instance a class with a name combined of
string and an integer? Maybe with some kind of boxing?
- Keeping the comboBox updated. Maybe ILists are the way to go here?
- Calling functions of the currently selected class in the comboBox.
Hope it gets clear with this explanation.
Thanks alot.
Jürgen