如何让checklistbox的选项上下移动位置?
请各位指点!
通过NumericUpDown,让checklistbox被打钩的选项上下移动。
[解决办法]
Public Class Form1
Dim BZ As Integer
Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
If NumericUpDown1.Value > BZ Then
CheckedListBox1.Items.Insert(CheckedListBox1.SelectedIndex - 1, CheckedListBox1.SelectedItem.ToString)
CheckedListBox1.Items.RemoveAt(CheckedListBox1.SelectedIndex)
End If
If NumericUpDown1.Value < BZ Then
CheckedListBox1.Items.Insert(CheckedListBox1.SelectedIndex + 1, CheckedListBox1.SelectedItem.ToString)
CheckedListBox1.Items.RemoveAt(CheckedListBox1.SelectedIndex)
End If
BZ = NumericUpDown1.Value
End Sub
Private Sub CheckedListBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CheckedListBox1.MouseClick
NumericUpDown1.Value = CheckedListBox1.SelectedIndex
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
BZ = 0
End Sub
End Class