how to set gridview.Column

Post your Gambas programming questions here.
Post Reply
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

how to set gridview.Column

Post by bill-lancaster »

I must be missing something here!
I want to set the column from code.
GridView1.Column = 2
But Print GridView1.Column shows "-1"

Any ideas welcome
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: how to set gridview.Column

Post by cogier »

Hi Bill.

You need Gridview1. Columns. Count = 2.

And a useful trick to use after you have filled your Gridview is to auto arrange the Columns widths with: -

Gridview1. Columns. Width = - 1
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: how to set gridview.Column

Post by bill-lancaster »

Thanks for the quick response.
I have already set up the table with GridView1.Columns.Count = 3 and filled the table with data.
I'm using the _Sort event but would like to force the sorting of a column from code. So after setting up the gridview:-

Code: Select all

Public Sub Button1_Click()
  GridView1.Column = 2
  Print "CC";; GridView1.Column

End
is where the problem is.
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: how to set gridview.Column

Post by bill-lancaster »

GridView1.Columns.Sort = 2
does it.
Regards
Post Reply