The following program compiles by F5 but Alt1 gives error:
Can any one tell me why? Part of code is here. Zip file is attached.
Error message: Index was out of range. Must be non negative and less than size of collection.
Parameter name: Index
Line number: 36
Line: MakeButtonArray ("FormTtable", "btnTt", "ClickTtableBtn", txtFontSize.Text , txtStartPt.Text _
, txtNoOfCols.Text , txtHeight.Text , StudentNumber)
Can any one tell me why? Part of code is here. Zip file is attached.
B4X:
Sub MakeBtnOnFormTtable ' Creates the buttons on the form Ttable
MakeButtonArray ("FormTtable", "btnTt", "ClickTtableBtn", txtFontSize.Text , txtStartPt.Text _
, txtNoOfCols.Text , txtHeight.Text , StudentNumber)
End Sub
Sub MakeButtonArray (frmName, btnName, btnClickSubName, btnFontSize, StartRow, btnNoOfCols, btnHeight, btnTotalNo)
'' FUNCTIONS - Makes buttons via programming
btnWidth = Int( 240/btnNoOfCols)
Ccol = 0
Rrow = StartRow
For btnNo = 1 To btnTotalNo
AddButton (frmName, btnName&btnNo, Ccol, Rrow, btnWidth, btnHeight, btnNo)
Button(btnName&btnNo).fontsize = btnFontSize
AddEvent(btnName&btnNo,click,btnClickSubName)
Ccol = Ccol + btnWidth
If Ccol >= 240 Then
Ccol = 0
Rrow = Rrow + btnHeight
End If
Next
End Sub
Attachments
Last edited: