Hi,
I have a report containing a tablix with a textbox (TextBox25) that needs to display the current page number.

In the report code I have:
Public Shared PageNumber as Integer
Public Function ChangePageNumber(ByVal PageNum As Integer)
PageNumber = PageNum
End Function
Public Function GetPageNumber()
Return PageNumber
End Function
In the header I have a hidden textbox with: =Code.ChangePageNumber(Globals!PageNumber)
And in TextBox25 I have: =Code.GetPageNumber()
This results in:

Where the first page number in the list should match the page number shown in the footer.
Can you please tell me why this is failing to work as expected? All sources tell me that the header event should always be processed first, then the body event.
I am previewing the report in Microsoft Visual Studio Professional 2022 (64-bit) using Microsoft SQL Server Reporting Services Version 16.0.20143.0.
Regards
Mike