Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 275197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:43:36+00:00 2026-05-12T00:43:36+00:00

I have added an EventHandler for the Click-event to a picturebox but on runtime

  • 0

I have added an EventHandler for the Click-event to a picturebox but on runtime this handler is never called (the debugger shows me that it is added to the control directly but when I click on the picturebox nothing happens).

I assume it has something to do with my inheritance. I have a usercontrol called AbstractPage (its not really abstract since the designer doesnt like that) which only consists of a heading and this picturebox but it provides quite some functions the actual pages rely on.

#region Constructor
public AbstractPage()
{
    InitializeComponent();
    lblHeading.Text = PageName;
    picLock.Click += new EventHandler(picLock_Click);
}
#endregion

#region Events
void picLock_Click(object sender, EventArgs e)
{
    ...do some stuff
}
#endregion

The page implementations just inherit this class and add their controls and behavior. We recently figured out that subclassing UserControl is not performant and we lose some performance there, but its the best way to do it (I dont want to c&p function for 25 pages and maintain them).

My pageA looks like this

public partial class PageA : AbstractPage
{
    #region Constructor
    public PageA()
    {
    // I dont call the base explicitely since it is the 
    // standard constructor and this always calls the base
        InitializeComponent();
    }
    #endregion

    public override string PageName
    {
        get { return "A"; }
    }

    public override void BindData(BindingSource dataToBind)
    {
    ...
    }

Anyway, the picLock_Click is never called and I dont know why?

The pages are all put into a PageControl which consists of a TreeView and a TabContainer where the pages are put once I call addPage(IPage)

public partial class PageControl {
    ...
protected virtual void AddPages()
{
    AddPage(new PageA());       
    AddPage(new PageD());
    AddPage(new PageC());
    ...
}

protected void AddPage(IPage page)
{
    put pagename to treeview and enable selection handling
    add page to the tabcontainer    
}

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:43:36+00:00Added an answer on May 12, 2026 at 12:43 am

    I found the problem. We are using the Infragistics WinForms but in that case I used the standard picturebox. I replaced it with the UltraPictureBox and now it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say that i have this button which is called Click_Here and i added
I have an event that triggers upon a treeview node click, this then creates
I have a LI element to which I have added a Toggle event handler
I have added a Button in the View { xtype:'button', id:'when_button_click', text:'Button Click', ui:'alert'
I have added some code which compiles cleanly and have just received this Windows
I have added the required assemblies and registered the NVelocityViewFactory in global.asax.cs page but
I have a code like this where I am trying to add an event
I am a bit confused, I have a bunch of elements that get added
I have declared a event on my user control public event EventHandler<AddressEventArgs> SaveButtonClick; protected
This must be something that a lot of people have done. Basically, it's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.