本文整理汇总了VB.NET中System.Windows.Forms.DomainUpDown.SelectedIndex属性的典型用法代码示例。如果您正苦于以下问题:VB.NET DomainUpDown.SelectedIndex属性的具体用法?VB.NET DomainUpDown.SelectedIndex怎么用?VB.NET DomainUpDown.SelectedIndex使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.DomainUpDown
的用法示例。
在下文中一共展示了DomainUpDown.SelectedIndex属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MySub
Protected domainUpDown1 As DomainUpDown
Private Sub MySub()
' Create and initialize the DomainUpDown control.
domainUpDown1 = New System.Windows.Forms.DomainUpDown()
' Add the DomainUpDown control to the form.
Controls.Add(domainUpDown1)
End Sub
Private Sub button1_Click(sender As System.Object, e As System.EventArgs)
' Add the text box contents and initial location in the collection
' to the DomainUpDown control.
domainUpDown1.Items.Add((textBox1.Text.Trim() & " - " & myCounter))
' Increment the counter variable.
myCounter = myCounter + 1
' Clear the TextBox.
textBox1.Text = ""
End Sub
Private Sub checkBox1_Click(sender As System.Object, e As System.EventArgs)
' If Sorted is set to true, set it to false;
' otherwise set it to true.
If domainUpDown1.Sorted Then
domainUpDown1.Sorted = False
Else
domainUpDown1.Sorted = True
End If
End Sub
Private Sub domainUpDown1_SelectedItemChanged _
(sender As System.Object, e As System.EventArgs)
' Display the SelectedIndex and SelectedItem property values in a MessageBox.
MessageBox.Show(("SelectedIndex: " & domainUpDown1.SelectedIndex.ToString() & _
ControlChars.Cr & "SelectedItem: " & domainUpDown1.SelectedItem.ToString()))
End Sub
示例2: MainClass
' 导入命名空间
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Public Class MainClass
Shared Sub Main()
Dim form1 As Form = New Form1
Application.Run(form1)
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DomainUpDown1.SelectedIndex = 0
End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class Form1
Inherits System.Windows.Forms.Form
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.DomainUpDown1 = New System.Windows.Forms.DomainUpDown
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'DomainUpDown1
'
Me.DomainUpDown1.Items.Add("January")
Me.DomainUpDown1.Items.Add("February")
Me.DomainUpDown1.Items.Add("March")
Me.DomainUpDown1.Items.Add("April")
Me.DomainUpDown1.Items.Add("May")
Me.DomainUpDown1.Items.Add("June")
Me.DomainUpDown1.Items.Add("July")
Me.DomainUpDown1.Items.Add("August")
Me.DomainUpDown1.Items.Add("September")
Me.DomainUpDown1.Items.Add("October")
Me.DomainUpDown1.Items.Add("November")
Me.DomainUpDown1.Items.Add("December")
Me.DomainUpDown1.Items.Add("Smarch")
Me.DomainUpDown1.Location = New System.Drawing.Point(48, 16)
Me.DomainUpDown1.Name = "DomainUpDown1"
Me.DomainUpDown1.Size = New System.Drawing.Size(152, 20)
Me.DomainUpDown1.TabIndex = 0
Me.DomainUpDown1.Text = "DomainUpDown1"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(33, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Month"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.DomainUpDown1)
Me.Name = "Form1"
Me.Text = "UseDomainUpDown"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents DomainUpDown1 As System.Windows.Forms.DomainUpDown
Friend WithEvents Label1 As System.Windows.Forms.Label
End Class