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?
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
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...
Re: Setting default properties in VB6?
Quote:
Originally Posted by
RhinoBull
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.
Re: Setting default properties in VB6?
Quote:
Originally Posted by
Ben321
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.
Re: Setting default properties in VB6?
Quote:
Originally Posted by
Ben321
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... ;)
Re: Setting default properties in VB6?
Quote:
Originally Posted by
RhinoBull
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?
Re: Setting default properties in VB6?
I've never heard of nor used Working Model Edition... Regardless, default install location is:
...\Microsoft Visual Studio\VB98\Template\Projects
Re: Setting default properties in VB6?
Quote:
Originally Posted by
RhinoBull
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.
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.
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/
Re: Setting default properties in VB6?
MZTools will work only if Working Model Edition supports Add-Ins.
Re: Setting default properties in VB6?
Btw, in so many years I haven't used this utility on a regular basis (handful of times if that many) so I don't really know what's the big deal about it. It's nice thou...
Re: Setting default properties in VB6?
Quote:
Originally Posted by
RhinoBull
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..
Re: Setting default properties in VB6?
Quote:
Originally Posted by
SuperDre
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.
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.
Re: Setting default properties in VB6?
Quote:
Originally Posted by
Ben321
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.
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).
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...
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:
Quote:
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.