PDA

Click to See Complete Forum and Search --> : Handy Little Snippets (1)


plenderj
May 22nd, 2002, 06:23 AM
This page is currently under construction.
Please check back often!

There is also another code snippets page available here (http://www.vbforums.com/showthread.php?s=&threadid=172611)

Contents, in order ;
00) Create vertical labels
01) Increment & Decrement Subs
02) Split a colour into its RGB components
03) By SLH (http://www.vbforums.com/member.php?s=&action=getinfo&userid=28721) : Looping through all controls on all loaded forms



'' Create vertical labels
'' By Hack (http://www.vbforums.com/member.php?s=&action=getinfo&userid=21196)
''
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 GeeSpot (http://www.vbforums.com/member.php?s=&action=getinfo&userid=23196)
''
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 SLH (http://www.vbforums.com/member.php?s=&action=getinfo&userid=28721)
''
Dim frm As Form
Dim Ctrl As Control
For Each frm In Forms
For Each Ctrl In frm
MsgBox Ctrl.Name
Next Ctrl
Next

plenderj
Oct 21st, 2004, 09:49 AM
* 21-October-2004 - Moved to CodeBank *