GetColorCount example for Visual Basic

Note: Also works with Access 95 and 97.

This example displays a message box showing the number of unique colors in the control's current bitmap.

' Declare local variables.
Dim szMessage As String ' Buffer for the MessageBox string
Dim NumberOfColors As Long ' Number of colors in the bitmap

' Get the number of colors in the bitmap.
NumberOfColors = Lead1.GetColorCount

' Display the result in a message.
szMessage = "The bitmap has " + CStr(NumberOfColors) + " colors"
MsgBox szMessage, 0, "Notice"