Results 1 to 8 of 8

Thread: Controlling if the application is in one or two files

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    523

    Controlling if the application is in one or two files

    Does any one know how to specify if you want to build your VB project with all the code for the form and logic in one file (i.e., the Designer file), or have the form design in the Designer file and the logic in the vb file?

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Controlling if the application is in one or two files

    Do you mean partial classes?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    523

    Re: Controlling if the application is in one or two files

    No. At least I don't think so. A student submitted a file with the content that normally is in the code file at the end of the Design file. So I have:

    form1.vb is blank
    form1.designer.vb has the details on the form objects and all the class code.

    I want to figure out what the student did so I can tell them what not to do.

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Controlling if the application is in one or two files

    Yes, a partial class. The student likely deleted their .vb file or at least deleted the Form definition, and then double-clicked a control, which would bring up the code file, which is missing, so at a guess reverts to the designer file.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    523

    Re: Controlling if the application is in one or two files

    I thought I read a while back that there was some option of having everything in a single file or with two files. I may be thinking of ASP.net, but I thought it was VB.

  6. #6
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Controlling if the application is in one or two files

    Quote Originally Posted by John_SC View Post
    No. At least I don't think so. A student submitted a file with the content that normally is in the code file at the end of the Design file. So I have:

    form1.vb is blank
    form1.designer.vb has the details on the form objects and all the class code.

    I want to figure out what the student did so I can tell them what not to do.
    Since this was a student, I have to ask if they found an old VS 2003 project online an did an upgrade that would have retained that structure.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Controlling if the application is in one or two files

    Quote Originally Posted by TnTinMN View Post
    Since this was a student, I have to ask if they found an old VS 2003 project online an did an upgrade that would have retained that structure.
    This is probably the most likely explanation. VB.NET 2003 and earlier used a single file - partial classes didn't exist - while VB 2005 and later use separate designer and user code files. Those separate files are just convention though. The IDE will use one or the other by default, depending on the circumstances but they both contain a partial class definition so you can put whatever code you want in either. There is no way that I've ever seen to tell VB 2005 or later to use a single code file by default.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    523

    Re: Controlling if the application is in one or two files

    I will see the student on Wednesday and try to figure out what happened. I doubt they found a VB2003 version of the program, but that would have been much more work than I asked the students to do. Thanks for everyone's input. I will post something back once I figure out what happened.

Posting Permissions

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



Click Here to Expand Forum to Full Width