Visual C# Winforms App Not Displaying Graphical Elements in Design Mode

Posted by Sev on Stack Overflow See other posts from Stack Overflow or by Sev
Published on 2010-06-02T06:36:14Z Indexed on 2010/06/02 6:53 UTC
Read the original article Hit count: 181

Filed under:
|

I wrote a bunch of code in the .cs file in c# for a winforms application. The application runs fine, and everything is in it's place.

Something like this:

using..

namespace Temp
{
  public class Temp : Form
  {
    Button b1;
    TextBox t1;

    Temp()
    {
       b1.Text = "Some Text";
       b1.Size = new Size(50,20);
       ...
    }

    void function1()
    {
       // stuff
    }

    static void Main()
    {
       Application.Run(new Temp());
    }
  }
}

How can I modify my code (or fix it somehow) so that the design view displays the elements in their correct positions and view so that I can visually edit them instead of having to trial/error everything.

Edit for Clarification

My application runs fine. The problem is, that I didn't use designer to create the application and so in the designer view, the app is empty. But not empty when I run it, since everything is positioned programmatically in the .cs file. My question is, how can I fix this, so that the designer shows the objects correctly.

There is no quick fix other than to redesign everything?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET