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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:30:20+00:00 2026-06-07T20:30:20+00:00

On my C# Winform (VS 2010 / C# / .Net 3.5), I have created

  • 0

On my C# Winform (VS 2010 / C# / .Net 3.5), I have created a button in the designer. I want to move and resize that button to a different location based on a user’s setting upon start-up of that form.

In my form’s load event, I have the following code to move and resize the button:

btnShare.Location = new System.Drawing.Point(16, 496);
btnShare.Margin = new System.Windows.Forms.Padding(4);
btnShare.Size = new System.Drawing.Size(408, 126);

All of the code to create the button is *.designer.cs file for this particular form.

The problem is this: When the form loads, I can see the button in it’s new location based on the 3 lines of code above. But then when the form is done loading and going through all it’s events, the button goes back to it’s original location which is in the *.designer.cs InitalizeComponent() method.

I do not want to take the code out of the *.designer.cs file and put it only into the form’s .cs file because I still want to be able to see the button in the designer when I work on the design of the form.

I just want to move and resize the button if the user has that option toggled upon loading of the form.

How can I do this since .Net seems to draw the buttons on my form after the load event has processed thus moving the button back to it’s original spot?

  • 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-07T20:30:22+00:00Added an answer on June 7, 2026 at 8:30 pm

    Here’s some code I just spiked together. and It works for me.

    This is a SSCCE, a Simple, Self-Contained Correct Example. Very useful when asking questions on SO.

    *Since I don’t know what your specific problem is, the Correct, part might not be accurate in this case

    Try and make a copy of this project, and see if you experience the same issue. If you don’t than We really can’t help you that much without getting more information about your project.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
    
                button1.Location = new Point(40, 40);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a WinForm Application with VB.Net (VS2010) having Office 2010 Professional Installed,
I have several WinForms .NET programs that are started using ClickOnce. The user logs
First of all, The Winform application is based on .Net Framework 1.1. I have
I am using a C# .NET 2.0 winform in 2010, I have added the
I have a WinForms app built with VB.Net in VS 2010, and I'm scratching
I have a .NET WinForms application that I've converted into a COM dll using
Technology: .NET 4, C#, WinForms, Visual Studio 2010 I have run into an issue
I have created a WinForms application using C# 2010. It contains a report created
I want to create a Visual Studio 2010 setup project that deploys some files
I have a c# winform project which is displaying much different on my screen

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.