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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:12:30+00:00 2026-06-09T20:12:30+00:00

I want to add buttons dynamically on c sharp windows form. the no of

  • 0

I want to add buttons dynamically on c sharp windows form. the no of buttons should be equal the no of records available in data table & i want to display the record whose button is clicked. could anybody help me?

  • 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-09T20:12:31+00:00Added an answer on June 9, 2026 at 8:12 pm

    In your case you need to create user control which will represent your item record on UI, create constructor which asspt your item and public event in this user control and add to your container like this.

    myPanel.Controls.Add(new ItemRecordUserControl(item));

    Probably you will need to use some specific containers instead of regular panel, something like System.Windows.Forms.FlowLayoutPanel.

    User control will looks like:

    public partial class ItemRecorUserControl : UserControl
    {
        public event EventHandler<EventArgs> ActionButtonClicked;
    
        public void OnActionButtonClicked(object sender, EventArgs e)
        {
            if (this.ActionButtonClicked != null)
                this.ActionButtonClicked(sender, e);
        }
    
        public ItemRecorUserControl()
        {
            InitializeComponent();
        }
    
        public ItemRecorUserControl(ItemRecord item) : this()
        {
            // fill item data here to controls
        }
    
        private void btnAction_Click(object sender, EventArgs e)
        {
            this.OnActionButtonClicked(sender, e);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop displaying records, and I want to add submit buttons to
I have a HBox and I dynamically add Buttons into it. I want to
i want to add buttons dynamically along with the scrollview ,suppose there are like
I'm trying to create a buttons dynamically and add them to table layout panel
I ve created the 8 buttons dynamically.I want to add all these buttons to
I want to create a .NET Form at runtime, add buttons and other controls
I want to dynamically add a radio button on a form, using VBA. I
I have been developing an Android RSS news reader.I want to add two buttons
I tried to add buttons, textboxes and text to tableview. I want the row
I want to add haptic feedback to my application's buttons and control them programmatically

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.