c# - How I send a constructor's two arguments to an event handler which manages a method? -


hy,

i have following constructor

public playme(**int rows, int cols, string name**)     {         **this.rows = rows;         this.cols = cols;         this.name = name;** 

.............................. whith following event handler:

        **load += playme_load<int>(rows, cols);**           initializecomponent();     } 

and method playme_load ( error before compiling: non generic method playme cannot used whith type arguments ...)

 void playme_load(int rows, int cols)         {             // set form components;              maximizebox = false;             autosize = true;             formborderstyle = formborderstyle.fixed3d;             backcolor = color.fromargb(30, 164, 6);             font = defaultfont;             **createboard(rows, cols);** 

how manage send arguments between constructor , event handler , method. referring @ rows , cols variable, can use name variabile also.

sincerly,

i see rows , cols stored in private fields (this.rows, this.cols), read them in method same (this.rows, this.cols) instead of trying pass parameters (don't add static specifier method).

when setting event handler can specify name of method.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -