Class error in asp.net

Discussion in 'ASP.NET / ASP.NET Core' started by spire, Dec 29, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I am having problems with class' in asp.net. I have been expriencing a lot of problems. I have worked with classes before and never ran into this issus. It seems that for some reason the compiler won't see any variables within the class. It throws a nullReferanceException whenever i try to access the variables. i have included error and code. Any advice would be greatly appriciated.

    When I build I am recieving this error:

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

    Code is here: Complile tracer points to bolded line
    Imports System.Data.SqlClient
    Public Class standardForums
    Inherits System.Web.UI.UserControl

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    End Sub

    Public Class bThread

    Public tester As String
    End Class

    Public Sub loadForums(ByVal which As Integer)
    Dim test As String
    test = forum.loadById(which)

    'lnkForumName.Text = forum.name
    ' lblDescription.Text = forum.description
    ' lnkModerator.Text = forum.moderator
    'If Not forum.icon = 0 Then


    Dim tester As New bThread
    lblDescription.Text = tester.tester

    End Sub

    End Class
     
  2. It appears to me that the problem is your bThread class lacks a new() method. So "tester = new bThread" is really doing nothing.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page