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 9050189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:35:42+00:00 2026-06-16T12:35:42+00:00

Using VS2010 on .NET v4 I have the following problems. I have created two

  • 0

Using VS2010 on .NET v4 I have the following problems.

I have created two custom Controls, Cell and Board and I want to use the Cell control to capture a number of events and to display some data. The most important event I need to capture is the Click event.

When the custom control has no child control items this is not a problem.
At the level wher Cell is used I can bind an event handler to the Click event with no problem.

    public partial class Cell : UserControl
    {
        ....
    }

    public partial class Board : UserControl
    {
        private void InitializeComponent()
        {
            ...
            this.Cell99.Click += new System.EventHandler(this.Cell_Click);
            ...
        }
    }

The Cell control is rather small (about 50×50 pixels in size) and one of the things I want it to display is an integer value as big as possible (about 50 x 50 pixes in size 😉 No problem in doing that, I want to use a Label control for that.

As soon as I add another (e.g. Label) control to Cell it no longer can see some events because the child event is getting ‘first rights’ on it. For the pixels that are covered by the Label control it will capture the Click event that I want to handle with the Cell control and not with the Label contol.

If it was only one control that I want to use in Cell the solution would be to link the event from the Label control to the Cell control. But I have at least 10 different (Label) controls that need to go in Cell to display all the information I have. Forwarding all the events for all the controls to its parent looks like a bit of a hassle to me. (Except from being prone to errors and other bugs.)

What is the propper way of disabling event capturing for child controls in a user control?

As said I have thought of forwarding events from child to parent but rejected that for now.

Then I have thought of not using controls to display the data but generate a bitmap with the information in it and use that as a background. I’m… not looking forward to that!

And finaly I came with an idea of putting one extra control, on top of all the others, and forward the events it’s captures to the parent. That might be the simplest way to continue.

Somehow I thing there must be a better way to approach this problem but how?

Any advise is welcome.

  • 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-06-16T12:35:44+00:00Added an answer on June 16, 2026 at 12:35 pm

    Implement a label class which inherits from Windows.Forms.Label. In this derived label/component class add a method or mechanism to forward any click event received by the label to the parent Cell control. Any labels which are added as child controls of a Cell would be of this custom label class and would all forward their Click events to the parent without having to manually do so for each label instance.

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

Sidebar

Related Questions

I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I'm using VS2010, C#, ASP.NET, I've inserted Ajax Control Toolkit Tab Container which works
I am following http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files . Using VS2010, ASP.NET 4.0, MVC3 in C# with ADO.NET
I have following code sample in ASP.NET using (PrincipalContext domainContext = new PrincipalContext(ContextType.Domain)) {
Using VS2010 and .net V4.0 I would like to achieve the following: I already
This is a simple website in ASP.NET with C# using VS 2010. I have
I am using VS2010 C#.NET 3.5 and application settings (the Settings.settings file). What I
Using WPF .NET 4.0 in VS2010 RTM: I can't create a fullscreen WPF popup.
I am developing a C# application using .NET Framework 4.0 in VS2010. It is
I'm using SQL Server 2008 as my database engine in a VS2010, C# ASP.NET

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.