button.visible problem

rayellam

Member
Licensed User
Longtime User
Hi All,
First im a noob with 48 hours experience using the trial version of B4A.
I am having a problem making 4 buttons visible/invisible at run time. If I just use one button in my program then everything works fine, if more than one then I get a compile error……………..

Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'btnhourdec' is used before it was assigned any value.
Occurred on line: 56
btnHourDec.Visible = False

The buttons are declared here……………….

Sub Globals

Dim btnHourInc As Button
Dim btnHoursDec As Button
Dim btnMinsDec As Button
Dim btnMinsInc As Button
End Sub

And used here………………………………………

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")

'Iniz Timer1 for clock update
If FirstTime Then
Timer1.initialize("Timer1", 1000)
Timer1.Enabled = True
End If

btnHourInc.Visible = False
btnHourDec.Visible = False

'btnHourDec.Visible = False
'btnMinInc.Visible = False
'btnMinDec.Visible = False
'pnlAlarmEdit.Visible = False
'lblAlarm1Start.Visible = False

End Sub

Any idea’s?

Thanks
 

stevel05

Expert
Licensed User
Longtime User
Your Dim says btnHoursDec but you are trying to access it as btnHourDec.
 
Upvote 0

rayellam

Member
Licensed User
Longtime User
OMG :sign0013:

late night last night with B4A, sometimes i cant see the wood for the trees.

It's a great app, 48 hours in and making great progress (apart from the stupid oversight :signOops:

Many thanks, i check more carefully before wasting peoples time in the future :)

Ray
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No problem, we've all done it!
 
Upvote 0

rbsoft

Active Member
Licensed User
Longtime User
This will not happen in B4A v1.8 anymore - one of the greatest advantages of that update!

Rolf
 
Upvote 0
Top