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

📄 form1.vb

📁 一些VB中数组运用的例子
💻 VB
字号:
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents lstDrink As System.Windows.Forms.ListBox
    Friend WithEvents txtIndex As System.Windows.Forms.TextBox
    Friend WithEvents txtName As System.Windows.Forms.TextBox
    Friend WithEvents btnAdd As System.Windows.Forms.Button
    Friend WithEvents btnSort As System.Windows.Forms.Button
    
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.txtIndex = New System.Windows.Forms.TextBox
        Me.lstDrink = New System.Windows.Forms.ListBox
        Me.btnAdd = New System.Windows.Forms.Button
        Me.txtName = New System.Windows.Forms.TextBox
        Me.btnSort = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'txtIndex
        '
        Me.txtIndex.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
        Me.txtIndex.Location = New System.Drawing.Point(144, 15)
        Me.txtIndex.Name = "txtIndex"
        Me.txtIndex.Size = New System.Drawing.Size(106, 22)
        Me.txtIndex.TabIndex = 1
        Me.txtIndex.Text = ""
        '
        'lstDrink
        '
        Me.lstDrink.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
        Me.lstDrink.ItemHeight = 16
        Me.lstDrink.Items.AddRange(New Object() {"高乐高", "汽水", "可乐", "奶茶"})
        Me.lstDrink.Location = New System.Drawing.Point(10, 15)
        Me.lstDrink.Name = "lstDrink"
        Me.lstDrink.Size = New System.Drawing.Size(115, 52)
        Me.lstDrink.TabIndex = 0
        '
        'btnAdd
        '
        Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
        Me.btnAdd.Location = New System.Drawing.Point(48, 90)
        Me.btnAdd.Name = "btnAdd"
        Me.btnAdd.Size = New System.Drawing.Size(77, 22)
        Me.btnAdd.TabIndex = 2
        Me.btnAdd.Text = "新增"
        '
        'txtName
        '
        Me.txtName.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
        Me.txtName.Location = New System.Drawing.Point(144, 52)
        Me.txtName.Name = "txtName"
        Me.txtName.Size = New System.Drawing.Size(106, 23)
        Me.txtName.TabIndex = 1
        Me.txtName.Text = ""
        '
        'btnSort
        '
        Me.btnSort.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte))
        Me.btnSort.Location = New System.Drawing.Point(144, 90)
        Me.btnSort.Name = "btnSort"
        Me.btnSort.Size = New System.Drawing.Size(77, 22)
        Me.btnSort.TabIndex = 2
        Me.btnSort.Text = "排序"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(259, 116)
        Me.Controls.Add(Me.btnSort)
        Me.Controls.Add(Me.btnAdd)
        Me.Controls.Add(Me.txtName)
        Me.Controls.Add(Me.txtIndex)
        Me.Controls.Add(Me.lstDrink)
        Me.Name = "Form1"
        Me.Text = "f10_5_1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    '************** f10_5_1 **************
    Private Sub lstDrink_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstDrink.SelectedIndexChanged
        txtIndex.Text = "索引指针:" & Str(lstDrink.SelectedIndex)
        txtName.Text = lstDrink.Text
    End Sub

    Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        lstDrink.Sorted = False     '要新增列表选项前,先使列表选项不具有排序的功能

⌨️ 快捷键说明

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