F
Ferret Face
Hello, Folks!
I have a large number of web object appearing on the same page so I decided to break them down into a number of panels with some control buttons like "Prev" and "Next" to make the appropriate panel visible. To help accoplish this I assign the panels to a panel array. Well I'm getting "Object reference not set to an instance of an object." as an error message causing me to go, "WTF!?"
Can anyone shed some light on this problem?
TIA...
Here's my code:
Imports ...blah, blah, blah.
Public Class ClinicalTrials
Inherits Page
'Declare web objects
Protected lblWarnings as Label
Protected pnlClinicalTrials1 as Panel
Protected pnlClinicalTrials2 as Panel
Protected pnlClinicalTrials3 as Panel
Protected pnlClinicalTrials4 as Panel
Protected pnlClinicalTrials5 as Panel
Dim PgArray() as Panel = {pnlClinicalTrials1, pnlClinicalTrials2, pnlClinicalTrials3, _
pnlClinicalTrials4, pnlClinicalTrials5}
....
Private Sub btnNext_Click(sender as Object, e as EventArgs) Handles btnNext.Click
'Make next page (or panel) visible
Dim i as Integer
Dim j as Integer
lblWarnings.Style("color") = "black"
lblWarnings.Text = ""
Try
'Find which is visible
For i = 0 to UBound(PgArray)
If PgArray(i).Visible Then
j = i
Exit For
End If
Next
'Addition of one
j = (j + 1) Mod (UBound(PgArray) + 1)
'Make next panel visible
For i = 0 to UBound(PgArray)
If (i = j) Then
PgArray(i).Visible = True
Else
PgArray(i).Visible = False
End If
Next
Catch err as Exception
lblWarnings.Style("color") = "red"
lblWarnings.Text = ""& err.Message &" Please contact Client Services to report this error. (btnNext_Click)"
End Try
End Sub
....
End Class
I have a large number of web object appearing on the same page so I decided to break them down into a number of panels with some control buttons like "Prev" and "Next" to make the appropriate panel visible. To help accoplish this I assign the panels to a panel array. Well I'm getting "Object reference not set to an instance of an object." as an error message causing me to go, "WTF!?"
Can anyone shed some light on this problem?
TIA...
Here's my code:
Imports ...blah, blah, blah.
Public Class ClinicalTrials
Inherits Page
'Declare web objects
Protected lblWarnings as Label
Protected pnlClinicalTrials1 as Panel
Protected pnlClinicalTrials2 as Panel
Protected pnlClinicalTrials3 as Panel
Protected pnlClinicalTrials4 as Panel
Protected pnlClinicalTrials5 as Panel
Dim PgArray() as Panel = {pnlClinicalTrials1, pnlClinicalTrials2, pnlClinicalTrials3, _
pnlClinicalTrials4, pnlClinicalTrials5}
....
Private Sub btnNext_Click(sender as Object, e as EventArgs) Handles btnNext.Click
'Make next page (or panel) visible
Dim i as Integer
Dim j as Integer
lblWarnings.Style("color") = "black"
lblWarnings.Text = ""
Try
'Find which is visible
For i = 0 to UBound(PgArray)
If PgArray(i).Visible Then
j = i
Exit For
End If
Next
'Addition of one
j = (j + 1) Mod (UBound(PgArray) + 1)
'Make next panel visible
For i = 0 to UBound(PgArray)
If (i = j) Then
PgArray(i).Visible = True
Else
PgArray(i).Visible = False
End If
Next
Catch err as Exception
lblWarnings.Style("color") = "red"
lblWarnings.Text = ""& err.Message &" Please contact Client Services to report this error. (btnNext_Click)"
End Try
End Sub
....
End Class