[Gambas-user] search in gridview or columnview

Peter Mathijssen pmathijssen at ...626...
Wed Jun 4 15:36:38 CEST 2008


It seems that this code:

 DIM iCountCol, iCountRow AS Integer

  IF Len(txtsearch.text) = 0 THEN
    FOR iCountRow = 0 TO (GridView1.Rows.Count - 1)
      GridView1.Rows[iCountRow].Selected = FALSE
    NEXT
    RETURN
  END IF

  GridView1.Mode = Select.Multiple

  FOR iCountRow = 0 TO (GridView1.Rows.Count - 1)
    FOR iCountCol = 0 TO (GridView1.Columns.Count - 1)
        IF InStr(GridView1[iCountRow, iCountCol].Text, txtsearch.Text, 0,
gb.Case) > 0 THEN
        GridView1.Rows[iCountRow].Selected = TRUE
        ELSE
        GridView1.Rows[iCountRow].Selected = FALSE
      ENDIF
    NEXT
  NEXT

only finds strings in column 1 and not in column 0.
It is a gridview with two columns, both columns contain strings of text.

Strange, the code looks fine. I just adapted it a bit from Stefano.

Peter



More information about the User mailing list