[thelist] ASP.NET: Using a Custom Class

Casey Crookston caseyc at IntelliSoftmn.com
Fri Jul 21 09:42:05 CDT 2006


Okay, I think I've almost got this. I really appreciate your help!  This
is my first attempt at creating my own namespace, I can't seem to find
instructions on this in ASP.NET Unleashed, and I've found very little to
help on Google. (I hope email doesn't screw up the formatting)


This is the class file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Imports ... 

Namespace quickCommands 

    Public Class csSendMail 

        Public Function emailForm(ByVal formResults, ByVal fromEmail)
            ...
        End Function

    End Class 

End Namespace

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the page's code behind file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Imports ...
Imports playground.quickCommands 

Public Class WebForm1

    Inherits System.Web.UI.Page 

    Sub btn_click(ByVal sender As Object, ByVal e As System.EventArgs) 

        Dim formResults As NameValueCollection
        formResults = Request.Form 

        Dim objSM As csSendMail
        lbl_submit.Text = objSM.emailForm(formResults,
formResults("Email_Address")) 

    End Sub

End Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The error is now: System.NullReferenceException: Object reference not
set to an instance of an object. 

On this line: lbl_submit.Text = objSM.emailForm(formResults,
formResults("Email_Address")) 

Thanks!

Casey




More information about the thelist mailing list