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

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "下拉列表框自动增量"
   ClientHeight    =   4095
   ClientLeft      =   1905
   ClientTop       =   1545
   ClientWidth     =   4845
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   4095
   ScaleWidth      =   4845
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Caption         =   "Example 1"
      Height          =   1575
      Left            =   180
      TabIndex        =   2
      Top             =   120
      Width           =   4275
      Begin VB.ComboBox Combo2 
         Height          =   315
         Left            =   600
         TabIndex        =   4
         Top             =   840
         Width           =   2655
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   600
         TabIndex        =   3
         Top             =   300
         Width           =   2655
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Example 2"
      Height          =   1575
      Left            =   180
      TabIndex        =   0
      Top             =   1800
      Width           =   4275
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   660
         TabIndex        =   1
         Top             =   660
         Width           =   2595
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Combo1_Change()
   Dim iStart As Integer
   Dim sString As String
   Static iLeftOff As Integer
   
   
   iStart = 1
   iStart = Combo1.SelStart
   If iLeftOff <> 0 Then
      Combo1.SelStart = iLeftOff
      iStart = iLeftOff
   End If
   sString = CStr(Left(Combo1.Text, iStart))
   Combo1.ListIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal CStr(Left(Combo1.Text, iStart)))
   If Combo1.ListIndex = -1 Then
      iLeftOff = Len(sString)
      Combo1.Text = sString
      
   End If
   Combo1.SelStart = iStart
   iLeftOff = 0
End Sub

Private Sub Form_Load()
    Dim i As Integer
    Dim k As String
    For i = 1 To 22
      k = Chr(i + 64) & CStr(i)
      Combo1.AddItem k
      Combo2.AddItem k
   Next i
End Sub

Private Sub Text1_Change()
   Combo2.ListIndex = SendMessage(Combo2.hwnd, CB_FINDSTRING, -1, ByVal CStr(Text1.Text))
End Sub

⌨️ 快捷键说明

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