Change ENTER to TAB 
By Eli Smadar:
Users ask to use intensively the ENTER key instead
of using the TAB (like they used to in DOS). 
Most of the tips I could find was using the KeyPress event and changing the ASCII code that was pressed. 
 
Unfortunately, this code has a side effect. When you hit the ENTER key a lot of times the keyboard hangs!!! This happened
with almost every component that I tried (standard VB, Apex etc.).
 
I found that if you want to achieve good result, you could use keybd_event API call. This way you can change the TAB key
code to VK_TAB (&H9) and have the OS handle the rest.
 
 
Public Const VK_TAB = &H9
Public Declare Sub keybd_event Lib "user32" _
    (ByVal bVk As Byte, ByVal bScan As Byte, _
    ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        KeyAscii = 0
        keybd_event VK_TAB, 0, 0, 0
    End If
End Sub
 |  
 
 
Right or Left Justify Output 
Use the Format$ function to produce right or left justified text.
    Format$(123, "@@@@@@")    gives   "   123"
    Format$(123, "!@@@@@@")   gives   "123   "
 
Formatting Numbers 
Use Format$(value, "0.00") to get 2 decimal places. Combine this with the "@@@@@" formats to get right justified numbers. For example:
    Print Format$(Format$(123.45, "0.00"), "@@@@@@@@")
    Print Format$(Format$(3.4, "0.00"), "@@@@@@@@")
    Print Format$(Format$(12345.6, "0.00"), "@@@@@@@@")
produces the following list:
      123.45
        3.40
    12345.60
 
Read and Write Arrays Quickly 
You can read and write arrays quickly from files using Put and Get. This is much faster than reading and writing the array one entry at a time.
    Dim arr(1 To 100000) As Long
    Dim fnum As Integer
        fnum = FreeFile
        Open "C:\Temp\xxx.dat" For Binary As fnum
        Put #fnum, , arr
        Close fnum
 
Send your Tips and Tricks to feedback@vb-helper.com.
 |