Putting the finishing touches on your VB program
Results 1 to 2 of 2

Thread: Putting the finishing touches on your VB program

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786

    Putting the finishing touches on your VB program

    No matter how small a project may be, it’s always a good idea to polish it up.

    By that I mean do things like:

    Check the tabbing sequence to be sure it makes sense and is easy to use. Many people don’t like to use a mouse and will knock you program if the order is screwy.

    It’s not a bad idea to add a button to start again or reset your app. Make it the last in the tab order and have it Set Focus to the first position of the tab order.

    Private Sub cmdReset_Click()
    Text1.SetFocus
    End Sub

    Using GotFocus, its nice to select all the text in the text box automatically, so you can just start typing and not have to manually select and delete what ever is already there.

    Private Sub Text1_GotFocus()
    SendKeys "{home}+{end}"
    End Sub

    The same thing can be done, when a text box is clicked on:

    Private Sub Text1_Click()
    SendKeys "{home}+{end}"
    End Sub

    Using this will terminate the program if the “esc” key is hit after the program first loads.

    Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 27 Then
    Unload Me
    End If

    End Sub

    Try to use the “ALT + Under Lined Letter” on every command button to execute that sub from the keyboard. Its made available by placing an “&” before the Letter you want to use for this purpose in the “Caption” property for that button.

    Really just a few simple tricks, which can make your program look and feel much more professional.

    I hope some find this helpful!
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Location
    Helsinki, Finland
    Posts
    570
    It’s not a bad idea to add a button to start again or reset your app. Make it the last in the tab order and have it Set Focus to the first position of the tab order.
    I'd try to keep the number of command buttons in minimum and do these kinds of jobs with menus. Menus can even have shortcut keys without any code messing with Form_KeyDown (or Form_KeyPress). For restarting I'd use 'F2.

    Private Sub Text1_GotFocus()
    SendKeys "{home}+{end}"
    End Sub
    Uhh, not like this... The following is generally more reliable and good programming habit because it uses the language's built-in functions:

    Code:
    Private Sub Text1_GotFocus()
        Text1.SelStart = 0
        Text1.SelLength = Len(Text1.Text)
    End Sub

    A little polishing thing I like to do is setting the version and such information for the exe file. This is done under "Project | Project1 Properties... | Make" -tab. You can set comments, company name, description and such things.
    This can also be done from the "Make Project" dialog clicking "Options" (File | Make Project1.exe...).
    Q: Why do computer scientists confuse Christmas and Halloween?
    A: Because Oct 31 = Dec 25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •