[Gambas-user] search in gridview or columnview

Peter Mathijssen pmathijssen at ...626...
Tue Jun 3 19:04:08 CEST 2008


Hi Stefano,

Thank you very much. I played a bit with your code and changed it to:


DIM iCountCol, iCountRow AS Integer

  IF Len(txtsearch.text) = 0 THEN RETURN

  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
THEN
        GridView1.Rows[iCountRow].Selected = TRUE
        ELSE
        GridView1.Rows[iCountRow].Selected = FALSE
      ENDIF
    NEXT
  NEXT

This way rows get selected when only a part of the text is found. I put the
routine in a textbox_change event.
Do you know how to get the row that has been clicked on with the mouse. I
want to select it.

I wonder is a gridview right for this sort of thing, or is a columnview
better?

Peter

2008/6/3 Stefano Palmeri <rospolosco at ...152...>:

> Il Tuesday 03 June 2008 14:08:33 Peter Mathijssen ha scritto:
> > Hello,
> >
> > I have a application in wich i want to use a columnview or a gridview. I
> am
> > searching for some code to search the gridview or columnview for a piece
> of
> > text. The grid will be two columns wide.
> > I want the rows that contain the found text selected.
> >
> > I found a piece of code to search a columnview but it doesn't do exactly
> > what i want.
>
> I've attached a gridview example. It selects rows which contains "hello".
>
> >
> > I am in the proces of making this app. that i developed in realbasic
> again
> > in gambas.
> > http://plekzondernaam.wordpress.com/not2complex/
> >
> > The gambas version looks like this now:
> > http://img112.imageshack.us/img112/8049/not2complexgambasky5.png
> >
> > I am also looking for a piece of code to fill the gridview or columnview
> > with a tab-delimited file. So one piece of text goes in column 1 and the
> > other piece in column 2.
> >
> --------------------------------------------------------------------
> DIM sStringArray as String[]
> DIM sWord as string
>
> sStringArray = split(file.load("path to file"), "\t")
>
> for each sWord in sStringArray
>
>  'here fill the grid
>
> next
>
> ---------------------------------------------------
>
> bye
>
>
>
>
> > Does someone have this already?
> >
> > Thanks in advance.
> >
> > Peter Mathijssen
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> 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