cannot set a form caption in code

444
1
07-14-2010 07:42 AM
xiaoyizhang
New Contributor
All,

I cannot set a form caption in code.
The subroutine is called from the page onLoad/onSetactive event. But the form caption does not change.


Sub getPageNum(pageNum)
Dim numPages
numPages = 0

Dim mForm
Set mForm =  ThisEvent.Object.Parent

Dim pPage
For Each pPage In mForm.Pages
  numPages = numPages + 1
Next

mForm.Caption = Application.Map.EditLayer.Name + " 1 of " + cStr(numPages)
End Sub
Tags (3)
0 Kudos
1 Reply
Almarde_Ronde
New Contributor
All,

I cannot set a form caption in code.
The subroutine is called from the page onLoad/onSetactive event. But the form caption does not change.


Sub getPageNum(pageNum)
Dim numPages
numPages = 0

Dim mForm
Set mForm =  ThisEvent.Object.Parent

Dim pPage
For Each pPage In mForm.Pages
  numPages = numPages + 1
Next

mForm.Caption = Application.Map.EditLayer.Name + " 1 of " + cStr(numPages)
End Sub


It might have to do with how you set the form object? Look at the help for the Object Property. I attached an applet that has a form with 2 pages. Switching the pages on the form changes the form's caption.
0 Kudos