Auto-center a Label

rfresh

Well-Known Member
Licensed User
Longtime User
I'm getting an object (LabeL) should first be initialized error on my Label with the following code to center a Label:


PHP:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Main")
   Dim lbl_cb2 As Label
   lbl_cb2.Left = Activity.width - lbl_cb2.width / 2
End Sub

Also am I accessing the screen width correct using Activity.width?

Thanks...
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…