troubleshooting Question

C# Issue, trying to call functions

Avatar of Sondelave
Sondelave asked on
C#
3 Comments1 Solution211 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros