Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 5, 1997

Right-Align Controls on Forms

When creating resizable forms, I like to place command buttons in either the upper-right or lower-right corners. For example, on data entry forms, I place record navigation buttons on the lower-left portion of the form along with an Add New Record button, Delete Record button, and a Find Record button. In the lower-right corner, I place buttons for print previewing reports and closing the form. Create this subroutine in a module or general declarations section of a form. With Offset, you can vary the distance from the right edge of the form, so you can right-justify more than one button:
 
Sub ButtonRight(X As Control, _
        Frm As Form, Offset as Integer)
                X.Left = Frm.ScaleWidth - _
                        X.Width - Offset
End Sub
Place two command buttons on the form. In the Form_Resize event, add this or similar code:
 
Private Sub Form_Resize()
        ButtonRight Command1, Me, 0
        ButtonRight Command2, Me, _
                Command1.Width
End Sub
James D.
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date