Sub Process_Globals
Dim cursor as ResultSet
Type btninfo(id As Int,colx As Int,rowy As Int,name As String)
Private btnlist As List
End Sub
Sub GetData
cursor = SQL.ExecQuery2("",...)
Do While cursor.NextRow
Dim btn As btninfo
btn.Initialize
btn.id = cursor.GetInt("id")
btn.colx = cursor.GetInt("colx")
btn.rowy = cursor.GetInt("rowy")
btn.name = cursor.GetString("name")
btnlist.Add(btn)
Loop
End Sub
Sub LoadButtons
For x = 0 To (maxX * maxY) - 1
Dim colx As Int = Round2(((b.left / (pnl.Width / maxX)) + 1),0)
Dim rowy As Int = Round2(((b.top / (pnl.Height / maxY)) + 1),0)
For i = 0 To btnlist.Size -1
Dim btn As btninfo = btnlist.Get(i)
If colx = btn.colx And rowy =btn.rowy Then
b.Tag = btn.id
b.Text= btn.name
End If
Next
End Sub