What i trying to do is to integrate windows forms controls with my classes.

For example if i press a button on my windows forms a function in a class should be called.

Now the problem is that i make an object from a class in the main. The event handler is simply not recognizing the object that i made in the main.

Can i get a simple example on what to write in an event handler so that i am able to access and manipulate the objects.

You have to subscribe to this event.
It means:

public MainForm()
{
    //button click event subscribtion:
    //if there is no this line of code, event will NOT rise!!
    button1_Click += new EventHandler(button1_Click);
}

//actualy event (it will be rised when button clicked:
private void button1_Click(object sender, EventArgs)
{

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.