[Gambas-user] Gridview delete row

Steven Lobbezoo steven at ...1652...
Tue May 1 10:35:00 CEST 2007


My grid has only up to 50 rows, so i did the following :

DIM r AS Integer

  WITH GridView1
    FOR r = .Row TO .Rows.Count - 2
      GridView1[r, 0].Text = GridView1[r + 1, 0].Text
      GridView1[r, 1].Text = GridView1[r + 1, 1].Text
      GridView1[r, 2].Text = GridView1[r + 1, 2].Text
      GridView1[r, 3].Text = GridView1[r + 1, 3].Text
      GridView1[r, 4].Text = GridView1[r + 1, 4].Text
      GridView1[r, 5].Text = GridView1[r + 1, 5].Text
    NEXT 
    .Rows.Count = .Rows.Count - 1 
  END WITH

Works just fine.
Steven

Le mardi 1 mai 2007 00:43, Gareth Bult a écrit :
> Mmm,
>
> Problem with that is the best place to store your info is in a result
> set .. trouble is, they're read only ... (!)
>
> Gareth.
>
> On Mon, 2007-04-30 at 23:58 +0200, Benoit Minisini wrote:
> > On lundi 30 avril 2007, Steven Lobbezoo wrote:
> > > Hi,
> > >
> > > Maybe a stupid question, but :
> > > What's the best and simplest way to remove a row from a grid.
> > > I could move all rows above the selected one, and then delete the last
> > > one by setting the count one less, but that seems complicated.
> > >
> > > If someone knows a better solution ??
> > > Thanks,
> > > Steven
> >
> > This is a method to implement. Something like GridView.Row[XXX].Delete()
> >
> > At the moment, the better way is to not store anything in the GridView,
> > to always use the Data event, and to store the GridView data in its own
> > structure that you can manipulate as you like.
> >
> > Regards,




More information about the User mailing list