Skip to content

The passed object doesnt have the member that i need, how to fix this?

Dillon Samuels

Asked Mar 25, 2009, 8:59 PM EDT1 answer
Share
LinkedInX

Hi,

I have a form "frmAddMovies" that has a button control "btn1". I have controller class "controller", i need to capture the click event occurs on "btn1" of "frmAddMovies " from the "Controller" class.

public class Controller
{

        public Button btnVirtual;

        public Controller(frmAddMovies form)
        {
            btnVirtual = form.btn1 //"btn1" doesnt display in the intellisense therefore risen an error.
    
    //later i need to add this event handler but without correcting the above live it's not possible
    btn1.click += new EventHandler(btn1_Click);
        }
}


public class frmAddMovies : Form
{
    ....................
    ....................
    ....................
}

How can i make the "form" object display the "btn1" in it's intellisense?


cheers

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    hi Dillon..

    make the button as public member of the class..then only it will be accessible.

    Amit R

    0