📄 bindingdemoform6.vb
字号:
Public Class BindingDemoForm6
Inherits System.Windows.Forms.Form
#Region " Windows Form 设计工具产生的程序代码 "
Public Sub New()
MyBase.New()
'此调用为 Windows Form 设计工具的必要项。
InitializeComponent()
'在 InitializeComponent() 调用之后加入所有的初始设定
End Sub
'Form 覆盖 Dispose 以清除组件列表。
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
'为 Windows Form 设计工具的必要项
Private components As System.ComponentModel.IContainer
'注意: 以下为 Windows Form 设计工具所需的程序
'您可以使用 Windows Form 设计工具进行修改。
'请勿使用程序代码编辑器来修改这些程序。
Friend WithEvents myComboBox As System.Windows.Forms.ComboBox
Friend WithEvents lblChoice As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.myComboBox = New System.Windows.Forms.ComboBox()
Me.lblChoice = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'myComboBox
'
Me.myComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.myComboBox.Location = New System.Drawing.Point(88, 24)
Me.myComboBox.Name = "myComboBox"
Me.myComboBox.Size = New System.Drawing.Size(288, 23)
Me.myComboBox.TabIndex = 0
'
'lblChoice
'
Me.lblChoice.ForeColor = System.Drawing.Color.Blue
Me.lblChoice.Location = New System.Drawing.Point(88, 168)
Me.lblChoice.Name = "lblChoice"
Me.lblChoice.Size = New System.Drawing.Size(288, 23)
Me.lblChoice.TabIndex = 1
'
'BindingDemoForm6
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 18)
Me.ClientSize = New System.Drawing.Size(464, 248)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblChoice, Me.myComboBox})
Me.MinimumSize = New System.Drawing.Size(472, 288)
Me.Name = "BindingDemoForm6"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "ComboBox 控件---复杂的数据绑定"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub BindingDemoForm6_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DepartmentArray() As String = _
{"生产制造部", "行销部", "财务部", "会计部", "业务部", "信息部"}
myComboBox.DataSource = DepartmentArray
End Sub
Private Sub myComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myComboBox.SelectedIndexChanged
lblChoice.Text = "您选择的选项是: " & myComboBox.SelectedItem.ToString
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -