Question

Hi im trying to fix this code in order to compile and cant find a way

ERROR:

Pro\AGeeksToy\Controls\LadderHeader.cs(218,98): error CS0426: The type name 'menuData' does not exist in the type 'AGeeksToy.CoreDataTypes.AGeeksToyToolStripMenuItem>'

this is the error.

   private void ChangeStakingType(AGeeksToyToolStripMenuItem<EnhancedType<StakingTypeEnum>>.menuData newType)
    {
        this.StakeBox.StakingType.Value = newType.Data.Value;
    }

AGeeksToyToolStripMenuItem class code:

  namespace AGeeksToy.CoreDataTypes
{
    using System;
    using System.Windows.Forms;

    public abstract class AGeeksToyToolStripMenuItem<T> : ToolStripMenuItem, AGeeksToyMenu
    {
        public MouseButtons LastMouseButton;
        public MenuData<T> menuData;
        public static readonly VoidEventWithParam<MenuData<T>> RightClicked;

        static AGeeksToyToolStripMenuItem()
        {
            AGeeksToyToolStripMenuItem<T>.RightClicked = new VoidEventWithParam<MenuData<T>>();
        }

        protected AGeeksToyToolStripMenuItem(T obj, string text) : this(obj, text, null)
        {
        }

        protected AGeeksToyToolStripMenuItem(T obj, string text, Control ctrl)
        {
            base.DropDown.ImageList = IconManager.m_ImageList;
            this.menuData = new MenuData<T>(obj, ctrl);
            this.Text = text;
        }

        protected override void Dispose(bool disposing)
        {
            base.DropDown.ImageList = null;
            base.Dispose(disposing);
        }

        protected override void OnClick(EventArgs e)
        {
            if (this.MenuControl != null)
            {
                this.MenuControl.Refresh();
            }
            base.OnClick(e);
            if (this.LastMouseButton == MouseButtons.Right)
            {
                AGeeksToyToolStripMenuItem<T>.RightClicked.TriggerEvent(this.menuData);
            }
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.LastMouseButton = e.Button;
            base.OnMouseDown(e);
        }

        public virtual void SetMenu()
        {
            this.LastMouseButton = MouseButtons.Left;
            if (this.MenuControl != null)
            {
                base.Visible = this.MenuControl.Visible;
                this.Enabled = this.MenuControl.Enabled;
            }
            foreach (ToolStripItem item in base.DropDownItems)
            {
                if (item is AGeeksToyMenu)
                {
                    (item as AGeeksToyMenu).SetMenu();
                }
            }
        }

        public T Menu_Data
        {
            get
            {
                return this.MenuObject;
            }
        }

        protected Control MenuControl
        {
            get
            {
                return this.menuData.Control;
            }
        }

        protected T MenuObject
        {
            get
            {
                return this.menuData.Data;
            }
            set
            {
                this.menuData.Data = value;
            }
        }


        public class MenuData<T>
        {
            public System.Windows.Forms.Control Control;
            public T Data;

            public MenuData(T obj, System.Windows.Forms.Control ctrl)
            {
                this.Data = obj;
                this.Control = ctrl;
            }
        }
    }
}

http://i.stack.imgur.com/XfUIA.png

Compile errors.

If anyone can download the project or check the source its available here

Download Link Google Code

Trunk available too but cant post direct link yet.

Thanks for any help

Was it helpful?

Solution

You are saying that you have a private void-returning method named ChangeStakingType that takes one parameter. The parameter's name is "newType" and the type of the parameter is AGeeksToyToolStripMenuItem<EnhancedType<StakingTypeEnum>>.menuData. But there is no type named menuData in your program. There is a field called menuData and a type called MenuData<T> but there is no type called menuData.

OTHER TIPS

C# is case sensitive.

You are trying to use the menuData class, when the actual class is called MenuData. Make that M uppercase

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top