January 28, 2001

Figuring out the current screen resolution

You can use the following small piece of code to detect the current screen resolution and then act on the information - for instance, by resizing form objects to suit the user's resolution.

Dim x,y As Integer
x = Screen.Width / 15
y = Screen.Height / 15

If x = 640 And y = 480 Then MsgBox ("640 * 480")
If x = 800 And y = 600 Then MsgBox ("800 * 600")
If x = 1024
And y = 768 Then MsgBox ("1024 * 768")