• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

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
0
Sondelave
Asked:
Sondelave
1 Solution
 
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
 
Arabia_vnCommented:
tb.ResetBG(); instead of tb.ResetBG;
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now