[Gambas-user] search in gridview or columnview
Peter Mathijssen
pmathijssen at ...626...
Wed Jun 4 16:31:50 CEST 2008
Thanks again Stefano,
Now it's working ok.
Still learning every time ;-)
Peter
2008/6/4 Stefano Palmeri <rospolosco at ...152...>:
> Il Wednesday 04 June 2008 15:36:38 Peter Mathijssen ha scritto:
> > 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
> > -------------------------------------------------------------------------
>
> Hi, Peter.
>
> It seems you forget a BREAK. In the way you wrote
> the code, the same Row could be selected and
> unselected in the same loop.
> To fix it add a BREAK when the Row is selected:
>
> IF InStr(GridView1[iCountRow, iCountCol].Text, txtsearch.Text, 0,
> gb.Case) > 0 THEN
> GridView1.Rows[iCountRow].Selected = TRUE
> BREAK
>
> Example attached.
>
> Bye,
>
> Stefano
>
>
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
More information about the User
mailing list