VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A 2 line code to center forms without api

by Casey (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

The purpose of this code is to expand on what Ian Ippolito stated in an early post with the same code. I noticed that his same code did not state all the versions that can take advantage of this code. This code will center a form on the screen, not taking into consideration the taskbar. Yes, there are other ways of achieving this, api being one of them, but who wouldn't rather have a smaller, simpler code?

Assumes
1 form, place code in form_load

Rate A 2 line code to center forms without api

Top = Screen.Height / 2 - Height / 2
 Left = Screen.Width / 2 - Width / 2

Download this snippet    Add to My Saved Code

A 2 line code to center forms without api Comments

No comments have been posted about A 2 line code to center forms without api. Why not be the first to post a comment about A 2 line code to center forms without api.

Post your comment

Subject:
Message:
0/1000 characters