怎样列与列之间的数据交换移动呢? 

解决方案 »

  1.   

    问题清楚一点.是在数据库中还是在那里?怎么个交换法.如果是整行交换,比如A与B列.那还不如读取的时候,本来先读A列的,改为先读B列.
      

  2.   

    这是一个从a列查数放c列最后,c列查数放b列最后,b列查数放a列最后,
    多余前移
    Private Sub Form_Load()
        With MSFlexGrid1
            .row = 1
            .col = 1
            .Text = "524312"
            .col = 2
            .Text = "dfd3333"
            .col = 3
            .Text = "euui33"
        End With
        
    End SubPrivate Sub Command1_Click()
        Dim strA As String
        Dim strB As String
        Dim strC As String
        
        Dim strR(3) As String
        Dim intS(3) As Integer
        Dim strT As String
        Dim i As Integer
        Dim j As Integer
        
        
        strA = "2"
        strB = "4"
        strC = "d"
        
        
        With MSFlexGrid1
            .row = 1
            
            For j = 1 To 3
                .col = j
                intS(j - 1) = Len(.Text)
            Next j
            
            For j = 1 To 3
            .col = j
                For i = 1 To Len(.Text)
                    If Mid(.Text, i, 1) = strA Then
                        .Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
                        strR(j - 1) = strA
                        Exit For
                    ElseIf Mid(.Text, i, 1) = strB Then
                        .Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
                         strR(j - 1) = strB
                        Exit For
                    ElseIf Mid(.Text, i, 1) = strC Then
                        .Text = Left(.Text, i - 1) & Mid(.Text, i + 1, Len(.Text))
                         strR(j - 1) = strC
                        Exit For
                    End If
                Next i
            Next j
            
            For j = 1 To 3
                .col = j
                .Text = .Text & strR(IIf(j = 3, 0, j))
            Next j
            
            For j = 3 To 2 Step -1
                .col = j
                strT = Left(.Text, Len(.Text) - intS(j - 1))
                .Text = Mid(.Text, Len(strT) + 1, Len(.Text))
                .col = j - 1
                .Text = .Text & strT
            Next j
        End With
                
                            
    End Sub