从手动填充的组合框中选择当前月份

时间:2013-11-28 04:54:23

标签: vb.net

 Me.drpmonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.drpmonth.FormattingEnabled = True
        Me.drpmonth.Items.AddRange(New Object() {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"})
        Me.drpmonth.Location = New System.Drawing.Point(886, 28)
        Me.drpmonth.Name = "drpmonth"
        Me.drpmonth.Size = New System.Drawing.Size(100, 21)
        Me.drpmonth.TabIndex = 9

手动我如上所示填充了组合框..应该从该组合框中选择加载当前月份的形式,如何实现

1 个答案:

答案 0 :(得分:1)

 Me.drpmonth.SelectedIndex = DateTime.Now.Month.ToString() - 1