sql2 = "select * from jr order by 金额 asc "
            Set rs = New ADODB.Recordset
            rs.Open sql2, cn, adOpenForwardOnly, adLockOptimistic            '____________将记录集内容显示到MSHFlexGrid1中______________
            Set MSHFlexGrid1.Recordset = rs
            MSHFlexGrid1.Refresh
         rs.Close
         cn.Close
想请教下如果金额为负的话变成蓝色要怎么改?

解决方案 »

  1.   

    '循环控件中的每行吧
    with mshflexgrid
        for i=1 to .rows-1
            if .textmatrix(i,5)<>"" then
                if cdbl(.textmatrix(i,5))<0 then
                    .row=i
                    .col=5
                    .cellbackcolor=vbred
                end if
            end if
        next i
    end with
      

  2.   

    是字体颜色不是背景色,改成fore后变部变红了。
      

  3.   

    With MSHFlexGrid1
      .Recordset = rs
      For i = 1 to .Rows-1
      If Val(.textmatrix(i,5)) < 0 Then
        .Row = i
        .Col = 5
        .CellForeColor = vbRed
      End If 
      Next i
      .Refresh
    End With