C# Issue, trying to call functions

Hi Guys,

Im VERY new to all of this and i need some help. I have two Component Classes,  RButton and TabPanel.

The TabPanel is a container to the RButton Component. When the OnMouseLeave event is raised on RButton Component Class I want to raise an event in the TabPanel Component Class.

RButton Event:

        protected override void OnMouseLeave(EventArgs e)
        {
            if (typeof(TabPanel) == this.Parent.GetType())
            {
                TabPanel tb = new TabPanel();
                tb = ((TabPanel)this.Parent);
                tb.ResetBG; //Error Occures Here, ResetBG is exposed here and can be called
                //MessageBox.Show(tb.Name); //Does show the correct name for this TabPanel
            }
            base.OnMouseLeave(e);
        }

The event in the in the TabPanel Component Class looks like this:

        public void ResetBG()
        {
            m_mode = 5;
            timer1.Start();
        }

When i try and compile the compiler has an issue with:

 tb.ResetBG;

Error:
Error      1      Only assignment, call, increment, decrement, and new object expressions can be used as a statement

Do i need to delegate or something? very lost and not been able to find anything on the Internet (mostly due to im not sure what to look for)

Thanks for your help
SondelaveAsked:
Who is Participating?
 
Arabia_vnConnect With a Mentor Commented:
tb.ResetBG(); instead of tb.ResetBG;
0
 
ajitha75Commented:
it should be ... note the braces

       protected override void OnMouseLeave(EventArgs e)
        {
            if (typeof(TabPanel) == this.Parent.GetType())
            {
                TabPanel tb = new TabPanel();
                tb = ((TabPanel)this.Parent);
                tb.ResetBG(); //Error Occures Here, ResetBG is exposed here and can be called
                //MessageBox.Show(tb.Name); //Does show the correct name for this TabPanel
            }
            base.OnMouseLeave(e);
        }

Thanks
Ajitha
0
 
SondelaveAuthor Commented:
Omg, at this is what happens when you spend hours looking at a screen! Such a simple thing lol

Thanks guys time for sleep i think.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.