Results 1 to 5 of 5

Thread: [RESOLVED] Get the Code that Makes the GUI

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2010
    Posts
    58

    Resolved [RESOLVED] Get the Code that Makes the GUI

    I just tried fooling around with a "windows forms" project, and I would like to see the code that creates the form. How would I go about looking at that?
    I can only edit the code that would occur from GUI events.

    EDIT: to clarify I am talking about the code that says "make the window these dimensions, make a button and put it here, make a textarea and put it here, etc)

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Get the Code that Makes the GUI

    in the solution/project explorer, there's a toolbar button "Show All Files" .. .turn it on... if you then look at your form, you should see a "+" next to it, showing there's files under it... expand it... what you're looking for the is the .designer file.... but be careful... changes in there can destroy your form, making it unusable (if you don't know what you're doing... and even in some cases when you do know what you're doing) ...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Get the Code that Makes the GUI

    There are two files associated with each form (actually three, but you can ignore the third). Normally, you see just the .VB file, which is your event handlers. However, there is also a .designer.vb file which can be found by clicking the ShowAllFiles icon at the top of the solution explorer window. That is where the code that creates and positions all the controls is located.
    My usual boring signature: Nothing

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Get the Code that Makes the GUI

    TG is right about editing that file. Changes can do bad things, such as making the form unopenable, and even crashing VS. However, it isn't magic. The objects follow the same rules as any other code. The control is declared in one section, created in a different section, a bunch of properties are set in yet another section, then the control is added to a controls collection near the end.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2010
    Posts
    58

    Re: Get the Code that Makes the GUI

    Thanks guys, I just want to share the code with my friend, so I need to be able to copy it.

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