Results 1 to 20 of 20

Thread: Setting default properties in VB6?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Setting default properties in VB6?

    I would like to set default properties for a number of control types in VB6. For example I'd like to set the default ScaleMode property for Form objects and PictureBox objects to Pixels (instead of twips), so that when I started up VB6 I wouldn't have to manually change the ScaleMode property on the Form and every PictureBox object I add (the factory default for these when you get VB6 out of the box is Twips, but Pixels are better for image-editing apps). Is there a way to set such default properties in VB6? Maybe a registry hack? Or some way to patch vb6.exe?

  2. #2
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Setting default properties in VB6?

    Ben

    Are you talking about Design Mode or Run Time?

    If the former, you do know about the Properties Window, right?
    If the latter, you could do it with code.

    Spoo

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Setting default properties in VB6?

    What you can do is make your own form template:

    - create new project
    - change form's ScaleMode property to 3 - Pixel
    - add the following code to Form_Load event:
    Code:
    Private Sub Form_Load()
    Dim ctl As Control
    
        For Each ctl In Me.Controls
            If TypeOf ctl Is PictureBox Then
                ctl.ScaleMode = vbPixels
            End If
        Next ctl
    
    End Sub
    - save new form to VB6 Template folder (default location is: C:\Program Files\Microsoft Visual Studio\VB98\Template\Forms)
    and give it some unique name

    Now try to add new form and select your new template - you should be all set.

    ...hope this works for you...

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Re: Setting default properties in VB6?

    Quote Originally Posted by RhinoBull View Post
    What you can do is make your own form template:

    - create new project
    - change form's ScaleMode property to 3 - Pixel
    - add the following code to Form_Load event:
    Code:
    Private Sub Form_Load()
    Dim ctl As Control
    
        For Each ctl In Me.Controls
            If TypeOf ctl Is PictureBox Then
                ctl.ScaleMode = vbPixels
            End If
        Next ctl
    
    End Sub
    - save new form to VB6 Template folder (default location is: C:\Program Files\Microsoft Visual Studio\VB98\Template\Forms)
    and give it some unique name

    Now try to add new form and select your new template - you should be all set.

    ...hope this works for you...


    Cool. Is it possible to make that template the one that starts up for EVERY time you run VB6 and select Standard EXE for the application type? Is it possible to configure different templates for various application project types? I want Form1 in EVERY project I make from now on to start with this new template.

  5. #5
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Setting default properties in VB6?

    Quote Originally Posted by Ben321 View Post
    Cool. Is it possible to make that template the one that starts up for EVERY time you run VB6 and select Standard EXE for the application type? Is it possible to configure different templates for various application project types? I want Form1 in EVERY project I make from now on to start with this new template.
    Well, I haven't done it before but I assume you can create different types of templates executable, dll, etc. If so the new template would just get appended to the template list rather than replacing one that is already there.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Setting default properties in VB6?

    Quote Originally Posted by Ben321 View Post
    Cool. Is it possible to make that template the one that starts up for EVERY time you run VB6 and select Standard EXE for the application type? Is it possible to configure different templates for various application project types? I want Form1 in EVERY project I make from now on to start with this new template.
    Create new Project template...

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Re: Setting default properties in VB6?

    Quote Originally Posted by RhinoBull View Post
    Create new Project template...

    Is this possible with VB6 Working Model Edition? Are templates possible with this version of VB6? If so, what folder do they go in?

  8. #8

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Re: Setting default properties in VB6?

    Quote Originally Posted by RhinoBull View Post
    I've never heard of nor used Working Model Edition... Regardless, default install location is:

    ...\Microsoft Visual Studio\VB98\Template\Projects
    Working Model Edition was a free version of VB6 that came on a CD packaged with certain VB6 guide books (not sure if it was one of the "Dummies" books or not). It's main difference from normal VB6 is that it can't compile EXE files. Is the "templates" feature also disabled for Working Model Edition? That's what I want to know.

  10. #10
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Setting default properties in VB6?

    I'm not sure why you're asking the same question over and over again?

    - When you open new project do you see Project selection dialog or not?
    - When you try to add new form do you see form selection dialog or not?
    - If you do then just follow those steps I posted - if it works then feature is available.

    Otherwise you need to get full version...

    Best regards.

  11. #11
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    264

    Re: Setting default properties in VB6?

    If you aren't already, just use the awesome IDE enhacement MZTools, It has features for that and much MUCH more. Personally I can't even imagine developing in the vb6 IDE without it.. (For Visual Studio .NET it's a different matter as a lot of the functions are already built in). It's free for vb6.. And I urge you to check out all the other options MZTools has, it'll make your development a lot easier in an already great IDE..

    http://www.mztools.com/

  12. #12

  13. #13

  14. #14
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    264

    Re: Setting default properties in VB6?

    Quote Originally Posted by RhinoBull View Post
    MZTools will work only if Working Model Edition supports Add-Ins.
    oh, I guess I read over that part.. Also never heard of the Working Model Edition.. And if he's using that one, and is not even able to create exe files, then why even bother asking questions about stuff which are only really interesting if you are doing real applications.. ahwell..

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Re: Setting default properties in VB6?

    Quote Originally Posted by SuperDre View Post
    oh, I guess I read over that part.. Also never heard of the Working Model Edition.. And if he's using that one, and is not even able to create exe files, then why even bother asking questions about stuff which are only really interesting if you are doing real applications.. ahwell..

    I got the regular VB6 I bought copy of on my desktop. On my laptop I've got Working Model because it was freely distributed with a book http://www.amazon.com/Programming-Vi.../dp/0072311908, and the regular VB6 is very expensive, so I only bought one copy of the regular VB6. And the license agreement (as with most software) says it can only be on one computer, so it's my desktop (my main computer) that I've installed the regular VB6 installed on. While the one on my laptop (my secondary computer) is Working Model and can't compile to EXE. Having it on my laptop allows me to work on projects on my laptop when I'm away from my desktop, and then transfer the project files to my desktop next time I'm at my desktop, so that I can then compile it on my desktop.
    Last edited by Ben321; Jun 25th, 2013 at 12:45 AM.

  16. #16
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    264

    Re: Setting default properties in VB6?

    ah, that makes sense.. I guess we all aren't as strict with that license, I'm using it as a 'one developer' so I have it installed on my desktop and my laptop (I can't use them both at the same time anyway)..

    But with MZTools you can set any default setting for any property you want.. Although I never tried it with a form, so I'm not sure if it will work for a form.. just checked it, nope it won't work for a form.. but as was mentioned here, just put your default form into C:\Program Files (x86)\Microsoft Visual Studio\VB98\Template\Forms and it'll show up in the add forms wizard.

  17. #17
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Setting default properties in VB6?

    Quote Originally Posted by Ben321 View Post
    the license agreement (as with most software) says it can only be on one computer
    Are you sure about that?

    I've installed VB6 many times (in multiple companies), and have read the licence agreement each time... and the ones I've read all said that the limit is one developer, and installing it on multiple computers (for that one developer) is allowed.

  18. #18
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Setting default properties in VB6?

    There are different type of licenses - personal, enterprise, etc... While personal allows installing only on a single computer (in most cases) enterprise allows multiple installs within the same business.
    However, number of users can also be limited (usually is).

  19. #19
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    264

    Re: Setting default properties in VB6?

    But then again, if MS doesn't care about VB6 development anymore (as there is also no businesssupport anymore), why would we bother with the license that strict.. but this license thing is all going off-topic, hehe...

  20. #20
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Setting default properties in VB6?

    As far as I know there was never any "personal" edition of VB6. It only came in Pro and Enterprise, with a "Working Model" only meant for inclusion with training materials and not legal for separate use or redistribution.

    VB6 was never a hobbyist product. "Standard" edition died with VB5.

    By the way, the EULA for both Pro and Enterprise say the same thing:
    1. LICENSE TO USE SOFTWARE PRODUCT.
    1.1 General License Grant. Microsoft grants to you as an individual, a personal, nonexclusive license to make and use copies of the SOFTWARE PRODUCT for the sole purposes of designing, developing, and testing your software product(s) that are designed to operate in conjunction with any Microsoft operating system product. You may install copies of the SOFTWARE PRODUCT on an unlimited number of computers provided that you are the only individual using the SOFTWARE PRODUCT. If you are an entity, Microsoft grants you the right to designate one individual within your organization to have the sole right to use the SOFTWARE PRODUCT in the manner provided above.
    So if anything you are in violation by using Working Model on your laptop! It is only for use along with the book.

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