I am having a problem with passing a button and form to a method.
Let me explain detail.when i click a button it will send some this button and a form to a method. The method then do some job. like
Let's see if I understood what you mean.
You want to pass to the showForm method the type of form to show and then show the kind of form desired.
If it's so, you can use reflection in the following way:
void ShowForm(Type formType)
Form frm = Activator.CreateInstance(formType) as Form; // your type must be some kind of form
if (frm != null)
frm.Show(); // showing the form
// formType is not a form, handle the error
I can't realy understand your examples (your naming is srtoa off), but if you just try to pass a button and a form to a method, they are objects like everything else.
void PassButton(Button myButton)
//Do stuff with myButton
void PassForm(Form myForm)
//Do stuff with myForm
//Form is the class from which your own for is derived, you can cast it to
//any form you want or use your selfmade Form (like F_Main)
1) Republic of Ireland algorithm? Never heard of it.
2) This does sound suspiciously like a google question and google will serve you a delicious feast of answers if you try.
3) Find out what you want to do and come back with any problems you have doing it.
That's all. Any more of these half brained antics and I'll start getting grumpy.