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

php - How to serve a file for download on WordPress -

how to share virtual sharepoint server and get it in host windows and visual studio? -