I searched for this for A while but I couldn't find the answer, so I hope it's not a duplicate.
I have the following code:
this.Controls.Add(new Label { Location = new Point(10, 10),
AutoSize = true,
Name = "jobNumStatic",
Text = "Job Number:",
Font = new Font(jobNumStatic.Font, FontStyle.Bold) });
I'm trying to change the font to bold. But that code gives the error, The name 'jobNumStatic' does not exist in the current context. Is there any way to make the font bold here?
I also tried:
jobNumStatic.Font = new Font(jobNumStatic.Font, FontStyle.Bold) });
After declaring the Label, and it gives me the same error.