Virtual - Override

NekoManu

Regular
Joined
Jul 23, 2004
Messages
75
Location
Belgium
I have a Usercontrol with a virtual method. When I use this control I want to override this method. I don't know how to do this. Can anybody help Please?

This is the Control:
Code:
namespace soReport
{
    public partial class ReportContainer : UserControl
    {
        private string _ProfileName = "";
        private string _ReportName = "";

        public ReportContainer(string ReportName)
        {
            InitializeComponent();
            _ReportName = ReportName;
        }

        private void ReportContainer_Load(object sender, EventArgs e)
        {
            RegistryKey ReportKey = Registry.CurrentUser.OpenSubKey(soSystem.RegistryEntry + soSystem.ApplicationTitle + "\\Reports\\" + _ReportName + "\\" + _ProfileName, true);
            if (ReportKey == null)
                ReportKey = Registry.CurrentUser.CreateSubKey(soSystem.RegistryEntry + soSystem.ApplicationTitle + "\\Reports\\" + _ReportName + "\\" + _ProfileName);

            GetContainerOptions(ReportKey);

            ReportKey.Close();
        }

        public virtual void GetContainerOptions(RegistryKey ReportKey)
        {
        }

        public string ProfileName
        {
            get { return _ProfileName; }
            set { _ProfileName = value; }
        }
    }
}

In the form where I use this control I want to override GetContainerOptions.
 
So, what are you saying? You want the form to override a subroutine that you have in the control?
Using override will override the virtual void, but you'll need to actually have that in a class that inherits from this usercontrol.

What you can do is, instead of trying to make the form implement this message, implement all of the messages, and then just pass another parameter to this subroutine so that you do the right thing. :)
 
Back
Top