If List1.ListIndex <> 0 Then
   List1.Text = List1.List(List1.ListIndex - 1) '上移
End If
If List1.ListIndex <> List1.ListCount - 1 Then
   List1.Text = List1.List(List1.ListIndex + 1) '下移
End If   

解决方案 »

  1.   

    little_hero(天生我才必有用!)說的應該可行
    不過應該改成 If List1.ListIndex > 0 因為可肯為-1
      

  2.   

    little_hero(天生我才必有用!): 我試過了,妳是對的,不用考慮小于0的情況
      

  3.   

    If List1.ListIndex > 0 Then
      List1.ListIndex= List1.ListIndex- 1) '上移
    End If
    If List1.ListIndex <> List1.ListCount - 1 Then
      List1.ListIndex=List1.ListIndex + 1) '下移
    End If  
      

  4.   

    在窗体上添加两个按钮一个列表框,然后粘贴以下代码
    Dim str1$Private Sub Command1_Click()
        
        If List1.ListIndex > -0 Then
            str1 = List1.List(List1.ListIndex - 1)
            List1.List(List1.ListIndex - 1) = List1.List(List1.ListIndex) '上移
            List1.List(List1.ListIndex) = str1
            List1.ListIndex = List1.ListIndex - 1
        End IfEnd SubPrivate Sub Command2_Click()
        If List1.ListIndex <> List1.ListCount - 1 Then
            str1 = List1.List(List1.ListIndex + 1)
            List1.List(List1.ListIndex + 1) = List1.List(List1.ListIndex) '下移
            List1.List(List1.ListIndex) = str1
            List1.ListIndex = List1.ListIndex + 1
        End If
    End Sub
      

  5.   

     '下移
    Private Sub cmddrown_Click()
        Dim sRomveName As String '被移动的名称
        Dim nlstselectItme As Long '被选项值
        
        nlstselectItme = lstSelectName.ListIndex
        If nlstselectItme < lstSelectName.ListCount - 1 Then
           sRomveName = lstSelectName.List(nlstselectItme)
           lstSelectName.RemoveItem nlstselectItme
           lstSelectName.AddItem sRomveName, nlstselectItme + 1
           lstSelectName.ListIndex = nlstselectItme + 1
        End If
    End Sub'上移
    Private Sub cmdup_Click()
        Dim sRomveName As String '被移动的名称
        Dim nlstselectItme As Long '被选项值
        
        nlstselectItme = lstSelectName.ListIndex
        If nlstselectItme > 0 Then
           sRomveName = lstSelectName.List(nlstselectItme)
           lstSelectName.RemoveItem nlstselectItme
           lstSelectName.AddItem sRomveName, nlstselectItme - 1
           lstSelectName.ListIndex = nlstselectItme - 1
        End If
    End Sub