table view changing the colour of one item

  1. last week

    i have a table view where i show the articles, which are in my database and if one item is empty i want it to be shown in red color so i can see the difference

        if amount = "0" then 
          
          MZListbox_user.Style = MZStyle_Text_Rot_Standard
          
        else
          if amount = "1"then
            
            MZListbox_user.Style = MZStyle_Text_Gelb_Standard
            
          else
            
          end 
        end

    i tried it with this code but it only works if all articles have the same amount, how can i say it should work each time?

    thankful for any help

    I don't know where you put this code but anyway, weblistbox.style applies to the whole weblistbox.
    You need to use CellStyle, see

    while not rs.eof
      
      lb.addrow (..,..)
      
      Select Case amount
      Case "0"
        lb.CellStyle(lb.lastindex, your_column_no) = MZStyle_Text_Rot_Standard
      Case "1"
        lb.CellStyle(lb.lastindex, your_column_no) = MZStyle_Text_Rot_Standard
      Else
      End Select
      
      rs.movenext
    wend
  2. Olivier C

    Dec 7 Pre-Release Testers, Xojo Pro Answer Europe (Belgium, Brussels)

    I don't know where you put this code but anyway, weblistbox.style applies to the whole weblistbox.
    You need to use CellStyle, see

    while not rs.eof
      
      lb.addrow (..,..)
      
      Select Case amount
      Case "0"
        lb.CellStyle(lb.lastindex, your_column_no) = MZStyle_Text_Rot_Standard
      Case "1"
        lb.CellStyle(lb.lastindex, your_column_no) = MZStyle_Text_Rot_Standard
      Else
      End Select
      
      rs.movenext
    wend

or Sign Up to reply!