VS 2020 No access to TableLayoutPanel control in WinForm's C# code view

34 Views Asked by At

I have been struggling with this problem all week. I read many posts here but none solved the problem.

The issue I’m having is with a program that is made up of two projects: a WinForm and a UserControl written in C# in the VS2022 environment.

The WinForm contains a TableLayoutPanel control. Each cell of the TableLayoutPanel is populated with a control from my UserControl project. The VS designer displays all this correctly.

When I build the UserControl project there are no errors. When I build the WinForm project (i.e frmSudokuProbe) I get the following errors: enter image description here

It says that there is no definition for tableLayoutPanel1 in the WinForm project but the designer code shows that tableLayoutPanel1 is defined: enter image description here

The WinForm project fails when it refers to tableLayoutPanel1: enter image description here

I rely on the VS designer to make the tableLayoutPanel1 control visible to the WinForm project on which it is displayed. But for some reason that control and only that control is not defined. This was not an issue until I upgraded to VS2022. I tried different combinations of target platforms on each project, including “AnyCpu” and “x86”. I tried different framework versions. I even reinstalled VS2019 with no success. Is there something I need to do? Is there a work around?

I'm looking for a clean compile.

0

There are 0 best solutions below