V
vbdev
Hi,
This is my 3rd post on the issue, but I am getting closer to a solution:
I have 1 project with 50 winforms name test01 to test50. These forms have a
public method named: MyVal
Right now I have the following code (where fName holds the form name):
string st = "init";
if (fName == "Test01")
{
Test01 myForm = new Test01();
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
}
else if (fName == "Test02")
{
Test02 myForm = new Test02();
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
}
..... all the way the Test50!!!!!!!!!!!!!!!!!!
This looks stupid! that's 49 elseif!
I am trying to make one generic call where I am feeding only the form name:
TestXX as a string:
If I have a var fName that holds my current form name, I would like to have
something(fName) myForm = new something(fName)
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
Any idea?
Thanks
vbdev
This is my 3rd post on the issue, but I am getting closer to a solution:
I have 1 project with 50 winforms name test01 to test50. These forms have a
public method named: MyVal
Right now I have the following code (where fName holds the form name):
string st = "init";
if (fName == "Test01")
{
Test01 myForm = new Test01();
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
}
else if (fName == "Test02")
{
Test02 myForm = new Test02();
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
}
..... all the way the Test50!!!!!!!!!!!!!!!!!!
This looks stupid! that's 49 elseif!
I am trying to make one generic call where I am feeding only the form name:
TestXX as a string:
If I have a var fName that holds my current form name, I would like to have
something(fName) myForm = new something(fName)
myForm.MyVal = st;
myForm.ShowDialog();
st = myForm.MyVal;
Any idea?
Thanks
vbdev