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

  • Home
  • SEARCH
  • 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 4625442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:16:23+00:00 2026-05-22T03:16:23+00:00

i am new here, actually i am working on project which is in c#,

  • 0

i am new here, actually i am working on project which is in c#, and in that project i want to display my form in the center of the screen… So for that i have written the following code..

public class CenterForm : System.Windows.Forms.Form
{
private System.ComponentModel.Container components;

public CenterForm()
{
    InitializeComponent();
    CenterToScreen();
}

protected override void Dispose(bool disposing)
{
    if (disposing)
    {
        if (components != null)
        {
            components.Dispose();
        }
    }
    base.Dispose(disposing);
}

private void InitializeComponent()
{
    this.button1 = new System.Windows.Forms.Button();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(107, 177);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(75, 23);
    this.button1.TabIndex = 0;
    this.button1.Text = "Ok";
    this.button1.UseVisualStyleBackColor = true;
    // 
    // CenterForm
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.Controls.Add(this.button1);
    this.Name = "CenterForm";
    this.Text = "DataGridExample";
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.CenterForm_Paint);
    this.Resize += new System.EventHandler(this.CenterForm_Resize);
    this.ResumeLayout(false);

}
[STAThread]
static void Main()
{
    Application.Run(new CenterForm());
}
private void CenterForm_Resize(object sender, System.EventArgs e)
{
    Invalidate();
    Console.WriteLine("Resize");
}
private void CenterForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
    Graphics g = e.Graphics;
    g.DrawString("Text",
      new Font("Times New Roman", 20),
      new SolidBrush(Color.Black),
      this.DisplayRectangle);
}

private Button button1;
}  

but it is giving some errors,that are
1)Error 1 ‘center.Form1.Dispose(bool)’: no suitable method found to override C:\Users\logicwaves\Documents\Visual Studio 2005\Projects\center\center\Form1.Designer.cs 14 33 center

2)Error 2 Program ‘C:\Users\logicwaves\Documents\Visual Studio 2005\Projects\center\center\obj\Debug\center.exe’ has more than one entry point defined: ‘center.Program.Main()’ C:\Users\logicwaves\Documents\Visual Studio 2005\Projects\center\center\Program.cs 13 21 center

3)Error 3 Program ‘C:\Users\logicwaves\Documents\Visual Studio 2005\Projects\center\center\obj\Debug\center.exe’ has more than one entry point defined: ‘CenterForm.Main()’ C:\Users\logicwaves\Documents\Visual Studio 2005\Projects\center\center\Form1.cs 58 17 center

what should i do, to overcome from these errors?

  • 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-22T03:16:24+00:00Added an answer on May 22, 2026 at 3:16 am

    no need for that CenterForm.StartPosition = FormStartPosition.CenterScreen;

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

Sidebar

Related Questions

Recently I have been working on a project where, among other things, we want
I'm starting a new project here (Windows Forms). What's the best option today for
My colleague here argues that new programmers must learn ASP first, before they learn
Im new into that asp.net thing, but here goes. I got at ImageButton, and
I am having a very diifult situation here...Actually I am developing a MFC project.In
I am working on a C++ project that uses Qt (gui lib), VTK (graphics
I am currently working on a PHP project which includes extensive database usage. The
I'm currently working on a program for a C course in which I have
I have a new web app that is packaged as a WAR as part
I'm working on a project which allows the advanced user to define their own

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.