Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

AutoComplete1 Sample (VB.NET)

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 Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim AutoCompleteObj As SftMaskAutoComplete
    Dim CaptionObj As SftMaskCaption

    CaptionObj = AxSftMask1.Caption
    AutoCompleteObj = AxSftMask1.AutoComplete

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

    AxSftMask1.Mask = "#####"
    AxSftMask1.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectEndHome

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

Private Sub AxSftMask1_MatchAddCustomItems(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_MatchAddCustomItemsEvent) Handles AxSftMask1.MatchAddCustomItems
    ' Ready to add custom items
    AxSftMask1.AutoComplete.AddTop("ZIP-Code Lookup ...", 1)
    AxSftMask1.AutoComplete.AddTop("State Lookup ...", 2)
    If e.count > 6 Then
        AxSftMask1.AutoComplete.AddBottom("ZIP-Code Lookup ...", 2)
        AxSftMask1.AutoComplete.AddBottom("State Lookup ...", 2)
    End If
End Sub

Private Sub AxSftMask1_MatchCustom(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_MatchCustomEvent) Handles AxSftMask1.MatchCustom
    If e.entryType = 1 Then
        AxSftMask1.Rollup()
        MsgBox("We could be looking up ZIP codes in another application...")
        AxSftMask1.Text = "12345"
    End If
    If e.entryType = 2 Then
        AxSftMask1.Rollup()
        MsgBox("We could be looking up states in another application...")
        AxSftMask1.AutoComplete.Refresh()
    End If
End Sub

Private Sub AxSftMask1_Matching(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_MatchingEvent) Handles AxSftMask1.Matching
    If Mid(e.entryText, 1, 1) = "0" Then
        ' don't show any ZIP code starting with a "0"
        e.accept = False
    End If
End Sub

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