Home > Net >  Implementation in c # window using the button calls has written a good class.
Implementation in c # window using the button calls has written a good class.

Time:10-12

Project is already written in a class, how to using the button in the window call,

CodePudding user response:

Static class called directly; Call non-static need instance

CodePudding user response:

Static class called directly; Call non-static need instance

CodePudding user response:

A new class of object you wrote

CodePudding user response:

Double click the button in the designer interface button, jump to the code, automatically generated
Private void button__Click (object sender, EventArgs e)
{
//call you here to write a good class
//if it is a static class
The name of the class. The method name (argument);
//if it is not a static class
The name of the class object name=new class name ();//constructor parameter is passed parameters, the default is no arguments structure;
The object name. The method name (argument);
}
PS: pay attention to what you write is Public class; Otherwise the classes you write permissions region here authority;

CodePudding user response:

reference night, 4/f, flowing haze response:
at the designer interface, double-click the button button to jump to the code, automatically generates the
Private void button__Click (object sender, EventArgs e)
{
//call you here to write a good class
//if it is a static class
The name of the class. The method name (argument);
//if it is not a static class
The name of the class object name=new class name ();//constructor parameter is passed parameters, the default is no arguments structure;
The object name. The method name (argument);
}
PS: pay attention to what you write is Public class; Otherwise the classes you write permissions region here authority;


This can refer to,
  •  Tags:  
  • C#
  • Related