简单的办法把它们添加到ListBox,把ListBox的Sorted属性设为true

解决方案 »

  1.   

    谁能介绍的详细点吗?
    option compare text怎么用?
      

  2.   

    字符串的比较原则是:先比较第一个字符,如果一小与二,那么字符串一小于字符串二;如果大于,那么字符串一大于字符串二;相等,则继续比较;
    'Test Program:
    'You Can Test the Result By griefforyou(为你伤心)'s Method
     
    Const str_Num = 3
    Dim a(0 To str_Num) As String
    Dim b(0 To str_Num) As String
    Dim i As Integer
    Dim j As Integer
    Private Sub Form_Load()
        a(0) = "aaa"
        a(1) = "bbb"
        a(2) = "bvvv"
        a(3) = "bcd"
        'List1.Sorted = True
        For i = 0 To str_Num
            b(i) = a(i)
        Next i
        For i = 0 To str_Num
    '        List1.AddItem a(i)
            For j = i To str_Num
                If a(i) > b(j) Then b(i) = a(i)
            Next j
        Next i
        For i = 0 To str_Num
            List1.AddItem b(i)
        Next i
    End Sub