Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object reference not set to an instance of an object

Status
Not open for further replies.

MONFU

Programmer
Oct 27, 2001
35
MT
Dear all

I am totally new to ASP.NET and I am trying to follow some examples from a book I have bought. However i have encountered the following error:-

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 56: strPanelName = "pnlForm" & ViewState("CurrentPage")
Line 57: pnlPanel = FindControl(strPanelName)
Line 58: pnlPanel.Visible = True
Line 59:
Line 60: End Sub


Source File: C:\Inetpub\ .aspx.vb Line: 58

Here is my code for this section:-

Sub btnNextPage_Click(ByVal s As Object, ByVal e As EventArgs)

Dim pnlPanel As Panel
Dim strPanelName As String

'Hide Previous Panel
strPanelName = "pnlForm" & ViewState("CurrentPage")
pnlPanel = FindControl(strPanelName)
pnlPanel.Visible = False

'Show current Panel
ViewState("CurrentPage") += 1
strPanelName = "pnlForm" & ViewState("CurrentPage")
pnlPanel = FindControl(strPanelName)
pnlPanel.Visible = True

End Sub

Can you please help me out?

Thanks
 
OK I found the error, I forgo to declare it in the HTML

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top