Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

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.

  • Leaders
Posted

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. :)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...