Handy Little Snippets (1)
This page is currently under construction.
Please check back often!
There is also another code snippets page available here
Contents, in order ;
00) Create vertical labels
01) Increment & Decrement Subs
02) Split a colour into its RGB components
03) By SLH : Looping through all controls on all loaded forms
VB Code:
'' Create vertical labels
'' By [URL=http://www.vbforums.com/member.php?s=&action=getinfo&userid=21196]Hack[/URL]
''
Private Function ShowVertical(ByVal MyString As String) As String
Dim i As Long
For i = 1 To Len(MyString)
If i < Len(MyString) Then
showVertical = showVertical + Mid$(MyString, i, 1) & vbCrLf
Else
showVertical ring = showVertical + Mid$(MyString, i, 1)
End If
Next
End Function
Private Sub Form_Load()
Label1.Caption = ShowVertical(Label1.Caption)
End Sub
'' Increment & Decrement Subs
'' By [URL=http://www.vbforums.com/member.php?s=&action=getinfo&userid=23196]GeeSpot[/URL]
''
Public Sub inc(ByRef n As Long)
n = n + 1
End Sub
Public Sub dec(ByRef n As Long)
n = n - 1
End Sub
'' Split a colour into its RGB components
''
Private Sub longToTriplet(ByVal colLong As Long)
MsgBox "Red = " & (colLong And &HFF)
MsgBox "Green = " & ((colLong \ &H100&) And &HFF&)
MsgBox "Blue = " & ((colLong \ &H10000) And &HFF&)
End Sub
'' Looping through all controls on all loaded forms
'' By [URL=http://www.vbforums.com/member.php?s=&action=getinfo&userid=28721]SLH[/URL]
''
Dim frm As Form
Dim Ctrl As Control
For Each frm In Forms
For Each Ctrl In frm
MsgBox Ctrl.Name
Next Ctrl
Next