Datatable / Result to dynamic Buttonarray

h725

Active Member
Licensed User
Longtime User
I need help in the following task:
I have the result of a database request. e.g.: "select id, productname from products"

I can loop through the result with:
For Each records() As Object In result.rows
id= records(0)
productname = records(1)
Next

I want to show the results in a buttonarray with a dynamic size and a page break
when the maximum buttons are shown. I will try to get into details:
I can access the number of results with : Dim number As Int = result.Rows.Size
I have e.g. 3 buttons in the horizontal, and I have e.g. 6 buttons in the vertical.
I have the number of results given with e.g. 100 results.
Now I need the following:
Drawing the buttonarray with (3*6 MINUS 1) buttons per page. Minus 1 because
I need one button to access the page break. Now if I push the page break button
(should be drawed in the down right) the next results of the dbrequest are drawed.
In this case I have results 18 to 35 shown in the page.

Every button needs a tag in which is stored the "id".
e.g. dim btn as button; btn.tag = id
If I push the button I want to make a new dbrequest with the id as a variable.

Please send me offers if you are interested.

Sourcecode must be written in B4A
 
Last edited:
Top