2013-11-03 49 views
0

我想知道是否有可能有两个按钮来更改当前选定的组合框“上一个”或“下一个”的项目。 所以我会有两个按钮:下一个和后一个,当你点击下一个时,组合框中选定的项目将变为列表中较低的一个(1 - > 2),如果你点击返回,它将返回到前一项目(1 < - 2)。 由于提前,更改与按钮vb.net组合框选定的项目

+1

是有可能。只需根据需要更改当前选定的项目 – Plutonix

+0

是的,但你会怎么做? – user2950509

回答

1

喜欢的东西...

Private Sub btnUp_Click(sender As System.Object, e As System.EventArgs) Handles btnUp.Click 
    If ComboBox1.SelectedIndex > 0 Then 
     ComboBox1.SelectedIndex = ComboBox1.SelectedIndex - 1 
    End If 
End Sub 

Private Sub btnDown_Click(sender As System.Object, e As System.EventArgs) Handles btnDown.Click 
    If ComboBox1.SelectedIndex < ComboBox1.Items.Count - 1 Then 
     ComboBox1.SelectedIndex = ComboBox1.SelectedIndex + 1 
    End If 
End Sub 
相关问题