How can a Visual Basic 6 program fit the screen. Is there a command for this and will it work for XP, Vista, and Windows 7

several different ways... Look in properties where is says windowstate. set it to vbmaximized or if form load me.windowstate = vbmaximized or me.width/height = screen.width/height and a few more ways...

Good Luck

several different ways... Look in properties where is says windowstate. set it to vbmaximized or if form load me.windowstate = vbmaximized or me.width/height = screen.width/height and a few more ways...

Good Luck

Will the vbmaximized work with the program running in XP, Vista, and Windows 7. Thanks for your help

Will the vbmaximized work with the program running in XP, Vista, and Windows 7. Thanks for your help

Yes, what vb5prgrmr has said will work for any Windows version.

You can also set this as a property in the VB6 IDE (if you didn't want to define it in the code). When you're in the form editor, go to the properties list of the form and you'll see WindowState there which you can set.

Jamesweeks,

You have to keep in mind that when you fit your form to a screen size, you need to resize all controls on the form as well to keep a proper and neat looking form.

I have attached a very basic sample on how to achieve this. You need to play around with it to suit your needs.

This will also work on any windows OS.

Thank you for your help

Only a pleasure.

Happy coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.