[Gambas-user] A question for Lee

T Lee Davidson t.lee.davidson at gmail.com
Thu Aug 10 20:45:00 CEST 2023


On 8/10/23 12:52, Gianluigi wrote:
> Also, instead of using a loop, we can just as well use the sub GridView1_Data.

And, if using a GridView, the columns can be set up as follows:
[code]
Public Sub Form_Open()

   Dim hConn As Connection = Connections["Connection1"]
   Dim hResult As Result
   Dim iColNum As Integer

   hConn.Open
   hResult = hConn.Exec("select * from `my_table` limit 0")
   GridView1.Columns.Count = hResult.Fields.Count
   For Each hField As ResultField In hResult.Fields
     GridView1.Columns[iColNum].Title = hField.Name
     Inc iColNum
   Next

End
[/code]


-- 
Lee



More information about the User mailing list