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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:23:54+00:00 2026-06-02T09:23:54+00:00

Hello I try to add multiple Buttons on a panel on form and next

  • 0

Hello I try to add multiple Buttons on a panel on form and next to each other but instead it put them above each other.
I am using the following function.
the Code:

    private void CreatBtn()
    {
        Point[] p = new Point[6];
        string log = "";
       Form2 frm2 = new Form2();

        Button[] btn = new Button[6];
        for (int i = 0; i < btn.GetLength(0); i++)
        {
                btn[i] = new Button();
                btn[i].Height = 65;
                btn[i].Width = 80;

                p[i] = new Point();
                p[i].X = i * 83;

                p[i].Y =0;

                log +=p.ToString() +"\n";
                btn[i].PointToClient(p[i]);
                btn[i].Show();         
        }

        panel1.Controls.AddRange(btn);

    }
  • 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-02T09:24:05+00:00Added an answer on June 2, 2026 at 9:24 am

    Add a Left value to your buttons

    btn[i] = new Button();
    btn[i].Height = 65;
    btn[i].Width = 80;
    btn[i].Left = i * 83; //Now they'll be next to each other.
    

    You may also consider using the FlowLayoutPanel.

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

Sidebar

Related Questions

Hello I try to use PcapDotNet dll but I can't add reference to my
hello guys i am try to use the StringUtils.remove Method but the below exception
Hello I'm creating an os x application for which I try to add a
Hello I'm new to iPhone development. I try to add move data from NSDictionary
I had spent few hours try to insert/add object but duplicated records happened. Campaign
Hello there i'm having a problem here i have an add and edit form
Hello I try to connect F# and MySQL database, but i got fallowing error
In an HttpModule, I put an Item in the Context, like this: HttpContext.Current.Items.Add(MyKey, Hello
Hello guys i try to get an object global/persistent over more than one php
hello guys i am try to print the output of two element data simultaneously

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.