Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check screen resolution size 1

Status
Not open for further replies.

munchen

Technical User
Joined
Aug 24, 2004
Messages
306
Location
GB
Is there a way of checking the screen resolution?

I have a form that has a datagrid on it that displays the results of a stored procedure. On form load I want to do the following:

Private Sub Form_Load()
If screen res = 800 x 600 then
datagrid.height = 1000
datagrid.width = 500
else
datagrid.height = 800
datagrid.width = 300
End Sub

I'm sure this can be done. Hope someone can help.
 
Screen.Width will tell you how many Twips wide your resolution is set to. Screen.TwipsPerPixelX will tell you how many twips are in a pixel (horizontally), so....

Screen.Width / Screen.TwipsPerPixelX will return the pixel resolution (horizontally).



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
You might also consider that non-VESA resolutions are becoming more common. Things like WXGA (1200x768 or even 1200x800 or 1366x768) and WUXGA (1920x1200, etc.) are beginning to pop up on desktops, mostly wide-aspect LCDs.
 
gmmastros

thats exactly what i needed. many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top