Size Form to fit user resolution

I have several multi-user Access applications. After much time-consuming research I have not been able to find anything that works on this question:

How can I get my forms to automatically fit the USER'S screen with their set resolution with the OnLoad event of a form

I have already tried me.height, me.width with no success. Anyone have any other suggestions Any help would be greatly appreciated.

Thanks!



Answer this question

Size Form to fit user resolution

  • user_whatever

    Blue are VB Keywords and purple is identifiers. You can setup custom formatting in the IDE through the options menu to make you coding easier to follow and find issues for yourself! In the Sample above in VB.Net it would be unneccesary to rename anything.... However it will not work inside of an office app such as Excel or Access!

    I'm moving this thread to the VBA forum so you can get a better response to your question

    MSDN Forums Moderator



  • arturm

    Sorry if this sounds stupid, but this is one of only 2 posts I've done in this forum. What's different about your blue words and your purple words I assume purples are objects or variables I need to name

    If that's not the case, I tried your code and it didn't work. Besides object names which of the above words in your code do I need to substitute with my application objects or variables

    Thanks for your time.


  • jvinsky

    Thanks Brendan.

    I get the following VB error:

    Run-time error '2465': Application-define or object-defined error. Here's my code. Did I miss something

    With Forms!Form1

    .Height = 300
    .Width = 300

    End with


  • wgcampbell

    What happens when you set Me.Height and Me.Width (or just Me.Size) to your desired size

    I ask because it sounds like you are on the right track to se the Height and Width properties of the form either within its constructor (but after the call to InitializeComponents) or within the handler of the Load function.



  • .neo

    OK - I get it finally - I saw the "not for VB6" in the header line of this forum. So where's the VB6 forum
  • dayrinni

    SInce this "Forms!Form1" is not .NET syntax...Is this a VBA question



  • raghu_grdr

    VB6 support can be found here:

    http://support.microsoft.com/ph/2971



  • Nathan Kerr

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Me.MaximizedBounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds

    Me.WindowState = FormWindowState.Maximized

    End Sub



  • David Norris

    This is a VBA forum, right Every time I enter this forum I am clicking on "Visual Basic Language"! If I'm in the wrong place - don't think I am though - how bout giving me a link to the RIGHT place, huh, huh, huh

    Anyway, thanks alot for your help. What I am seeking, however, is code that will work in Access - that's where my apps were developed. I guess I should have specified that to begin with huh DUH!

    So how bout it DMAN Got some VBA code or any other suggestions that'll work

    It's a good day - SMILE! (Emoticons are fun!)


  • phobia

    Yeah - VB. Sorry bout that.

    Don't know nothing about .NET... YET.


  • David Avsajanishvili

    If I want my entire website to fit to the user's resolution - can I still use this code If so, where do I put it


  • Size Form to fit user resolution