Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

AutoComplete1 Sample (VB6)

This sample illustrates autocomplete.

This is not an executable sample, so a complete project is not provided. These statements are intended to show basic concepts and the syntax used.

Private Sub Form_Load()
    Dim AutoCompleteObj As SftMaskLib70.SftMaskAutoComplete
    Dim CaptionObj As SftMaskLib70.SftMaskCaption

    Set CaptionObj = SftMask1.Caption
    Set AutoCompleteObj = SftMask1.AutoComplete

    CaptionObj.SizePercent = 33
    CaptionObj.Text = "&ZIP Code:"

    SftMask1.Mask = "#####"
    SftMask1.EntrySelect = entrySftMaskSelectEndHome

    AutoCompleteObj.File = "-\Softelvdm\AutoComplete\SampleFile2.Suggest"
    AutoCompleteObj.Encrypt = False
    AutoCompleteObj.IgnoreCase = True
    AutoCompleteObj.MaxEntries = 50
    AutoCompleteObj.Mode = autocompleteSftMaskSuggest
End Sub

Private Sub SftMask1_MatchAddCustomItems(ByVal Count As Long)
    ' Ready to add custom items
    SftMask1.AutoComplete.AddTop "ZIP-Code Lookup ...", 1
    SftMask1.AutoComplete.AddTop "State Lookup ...", 2
    If Count > 6 Then
        SftMask1.AutoComplete.AddBottom "ZIP-Code Lookup ...", 2
        SftMask1.AutoComplete.AddBottom "State Lookup ...", 2
    End If
End Sub

Private Sub SftMask1_MatchCustom(ByVal Text As String, ByVal EntryText As String, ByVal EntryType As Integer)
    If EntryType = 1 Then
        SftMask1.Rollup
        MsgBox ("We could be looking up ZIP codes in another application...")
        SftMask1.Text = "12345"
    End If
    If EntryType = 2 Then
        SftMask1.Rollup
        MsgBox ("We could be looking up states in another application...")
        SftMask1.AutoComplete.Refresh
    End If
End Sub

Private Sub SftMask1_Matching(ByVal Text As String, EntryText As String, Accept As Boolean)
    If Mid(EntryText, 1, 1) = "0" Then
        ' don't show any ZIP code starting with a "0"
        Accept = False
    End If
End Sub

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.