Here's the troublesome bit of code. Note that the NullReference Exception is throw for the variable TR, but PS is just fine. Any idea what could be happeneing?
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
''// set up the controls
Dim PS As Integer
Dim TR As Integer
PS = 0
TR = 0
''//...