Where is C# Windows Form Application main() function -
in c# windows form application,
- i have class race.
 - i want declare object of race class
 - and access object when button clicked
 
.
race class:
class race {     int player;     int position; }   object creation:
race obj = new race();   accessing object:
    private void button1_click(object sender, eventargs e)     {         obj.position++;     }   the question is, create race class object, can access when button clicked?
you'll need declare @ class level. in case, means needs field in form:
public class form1 : form {     private race race;      public form1()     {         race = new race();     }      public void button1_click(object sender, eventargs e)     {         race.position++;     } }      
Comments
Post a Comment