I am new to C# and I am playing with my first bits of code.
I am building an application from scratch and looking at some
old code to model my new app.
The strange thing is this. I know that the old code must have
some controls inside its forms because I can see controls
referenced inside the code view of the forms.
But when I look at the form view it comes up blank
The only difference between the two programs is their arangement
in the Solution Explorer. Here is how they are aranged in the
Notice how the .resx file is arranged in the tree structure.
This is how the files are arranged in the new program.
In the old sample code, I notice that there are Buttons, TextBoxes, and
GroupBoxes declared in the MainForm.Designer.cs file. So, why
can I not see this in the Form View?
Firstly does it compile? (I suspect the answer is yes if you can view the designer at all). The solution explorer in the new image looks fine...have you maybe got the two images mixed up?
How did you copy the old code? Did you just copy the MainForm.cs file, or did you copy both MainForm.cs and MainForm.Designer.cs?
In case you don't understand the way it works, MainForm is declared as a partial class. This means that its code is split across multiple files. One of the advantages of this is that it means that the Designer can generate code into MainForm.Designer.cs without affecting your logic in MainForm.cs and vice-versa. When you view the Designer it actually compiles and instantiates your code (I think), which means that if you can't see the controls they're either not there or are not visible.
If you go to the properties window when you are in the Designer, you should be able to click the combo box at the top of it to get a list of the controls that are present - a better way is to look at the outline view of your control (which shows stuff like how the controls are layered, etc).
Hope that helps,