Results 1 to 3 of 3

Thread: [RESOLVED] [02/03] Drop down list error

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    131

    Resolved [RESOLVED] [02/03] Drop down list error

    "Object reference not set to an instance of an object.
    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. "

    That's what it says when I press Submit on my form. Here is the portion of code:

    vb Code:
    1. Dim strBody As StringBuilder = New StringBuilder
    2.  
    3.         strBody.Append("CT Request" & vbCrLf & vbCrLf)
    4.  
    5.         strBody.Append("Name: " & txtName.Text & vbCrLf)
    6.         strBody.Append("Address: " & txtAddress1.Text & " " & txtAddress2.Text & vbCrLf)
    7.         strBody.Append("City: " & txtCity.Text & vbCrLf)
    8.         strBody.Append("State: " & ddlStates.SelectedValue & vbCrLf)
    9.         strBody.Append("ZIP: " & txtZIP.Text & vbCrLf)
    10.         strBody.Append("Email: " & txtEmail.Text & vbCrLf)
    11.         strBody.Append("Phone: " & txtPhone.Text & vbCrLf)
    12.         strBody.Append("Fax: " & txtFax.Text & vbCrLf)
    13.        'Drop down list right here strBody.Append("More Info: " & ddlInfo.SelectedValue & vbCrLf)
    14.         strBody.Append("Comments: " & txtComments.Text & vbCrLf)
    15.  
    16.         txtTest.Text = strBody.ToString

    No idea why it's giving me an error, I've used this method tons of other times here and it's worked fine.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [02/03] Drop down list error

    On which line? I'm guessing one of those controls doesn't exist.

  3. #3
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    790

    Re: [02/03] Drop down list error

    You have not from your code referred back to an instance of the StrBody object just before you say StrBody.append and just after the Dim statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width