Visual C# errors. Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Visual C# errors. Why?

Hi! I have a problem with a Visual C#. I created a form design for the code, all names in the code and designer match, but it shows me errors. How to fix this https://imgur.com/a/NIBhNDr ? Thank you in advance for any help!

4th Oct 2019, 6:03 PM
DIY Mods
DIY Mods - avatar
2 Answers
+ 2
It looks like you program is lacking some referrence's. You should first try to solve the error. "Program does not contain a static main" If you solve this error, the other ones will be solved as well. Did you make changes to program.cs ? Can you show use program.cs ? Also it is weird that program.cs is a "form"-file. It should be a source file with a "c#" instead. How did you start this application ?
4th Oct 2019, 7:39 PM
sneeze
sneeze - avatar
+ 1
You're showing us program.cs, which you broke when you turned it into a form, or you deleted the original and named a form class file program.cs. You have 2 classes, Form1 in program.cs, and distanceConverter. The variables you are trying to reference in Program.cs don't exist there because they are declared in the distanceConverter class.
8th Oct 2019, 2:51 AM
Jesse Bayliss
Jesse Bayliss - avatar