⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgmodintellisense.bas

📁 vb做的数据库 客户管理系统
💻 BAS
字号:
Attribute VB_Name = "msgmodIntelliSense"
'--------------------------------------------------------------------------------
Option Explicit

Global WasDelete As Boolean

Public Type iSense
    sOut As String * 50
End Type

Public Function IntelliSense(tBox As TextBox, AddRecord As Boolean) As String
    Dim iChannel As Integer, iActive As Integer, iLength As Integer, i As Integer
    Dim iFile As String
    Dim iSense As iSense
    Dim Done As Boolean

    iFile = App.path & "\IntellHelper.dat"
    iLength = Len(iSense)
    iChannel = FreeFile
    Open iFile For Random As iChannel Len = iLength
    Close iChannel

    iActive = FileLen(iFile) / iLength
    iChannel = FreeFile
    Open iFile For Random As iChannel Len = iLength
        If AddRecord Then
            iSense.sOut = tBox.Text
            Put iChannel, iActive + 1, iSense
        Else
            Do While Not EOF(iChannel) And Done = False
                i = i + 1
                Get iChannel, i, iSense
                If tBox.Text = Mid(RTrim(iSense.sOut), 1, Len(tBox.Text)) Then
                    IntelliSense = RTrim(iSense.sOut)
                End If
            Loop
        End If
    Close iChannel
End Function


Public Sub iSenseChange(tBox As TextBox)
    Dim iStart As Integer
    Dim iSense As String

    iStart = tBox.SelStart
    iSense = IntelliSense(tBox, False)
    If iSense <> "" And Not WasDelete Then
        tBox.Text = iSense
        tBox.SelStart = iStart
        tBox.SelLength = Len(tBox.Text) - iStart
    End If
End Sub


Public Sub iSenseKeyPress(tBox As TextBox, KeyAscii As Integer)
    If KeyAscii = 13 And tBox.Text <> "" Then
        IntelliSense tBox, True
    ElseIf KeyAscii = 8 Then
        WasDelete = True
    Else
        WasDelete = False
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -