The error message issued by the Form designer is clear -- Remove the manually inserted code from the InitializeComponent method. Try moving the manually inserted code to the Form's Load event handler.
What is wrong with this winform code
I wrote some code for a quiz app I'm trying to make which goes like this:
and it shows this error on the form:
the form shows up in the executable but the code doesn't work as intended.
how do I fix it?
2 answers
Sort by: Most helpful
-
-
Keshav Kumar 1 Reputation point
2022-09-06T00:06:16.803+00:00 I agree with answer of RLWA32-6355. After rolling back your changes, try double clicking the form in designer mode and it should insert a Form1_Load method automatically for you. Try adding your code in there in Form1.cs file in place of in Form1.designer.cs file. Also, I overserved that your if condition does not have colon after Health . May be you have displayed the code only for sample, but a point to look at something to fix your code.