Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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, _
End Sub
James D.
Comment and Contribute






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



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