Results 1 to 2 of 2

Thread: C# Forms

  1. #1
    Junior Member Xarzu's Avatar
    Join Date
    Jan 2008

    C# Forms

    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
    old program

    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?

  2. #2
    Custom User
    Join Date
    Oct 2001
    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,


Similar Threads

  1. Mark all forms as read on main page
    By HTRegz in forum Site Feedback/Questions/Suggestions
    Replies: 2
    Last Post: July 13th, 2004, 02:00 PM
  2. Avoid those nasty signup forms
    By allenb1963 in forum Miscellaneous Security Discussions
    Replies: 13
    Last Post: July 10th, 2004, 05:15 AM
  3. Adobe Acrobat Reader XML Forms Data Format Buffer Overflow
    By SDK in forum Miscellaneous Security Discussions
    Replies: 0
    Last Post: March 8th, 2004, 04:52 PM
  4. Replies: 1
    Last Post: July 15th, 2002, 03:46 AM
  5. using html forms
    By blayde in forum Web Development
    Replies: 11
    Last Post: November 25th, 2001, 05:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts