Search code examples
c#visual-studiowindows-forms-designer

Blank app when launching a windows form with C#


I am creating an interface for monitoring using C# in Visual Studio 2022. I wrote a simple code with a primal design when I build there are no errors or warnings - everything is good. But when I launch the app, its main form appears BLANK - just a white window with nothing in it.

This is the project folder:

https://drive.google.com/file/d/1289L4kocyYrBW9FGasU6Dhxs9r1vEHN7/view?usp=sharing

Please help me - it's for a school project.

Thank you

I tried all possible solution and checked all settings and still the same problem although the codes show no errors or warnings


Solution

  • Looks like the Form1 class is in it's own namespace called PowerConsumptionMonitor, and the startup code isn't referencing it properly. Modify this line in your Program.cs file:

    Application.Run(new Form1());
    

    to

    Application.Run(new PowerConsumptionMonitor.Form1());