[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:
Dim strBody As StringBuilder = New StringBuilder
strBody.Append("CT Request" & vbCrLf & vbCrLf)
strBody.Append("Name: " & txtName.Text & vbCrLf)
strBody.Append("Address: " & txtAddress1.Text & " " & txtAddress2.Text & vbCrLf)
strBody.Append("City: " & txtCity.Text & vbCrLf)
strBody.Append("State: " & ddlStates.SelectedValue & vbCrLf)
strBody.Append("ZIP: " & txtZIP.Text & vbCrLf)
strBody.Append("Email: " & txtEmail.Text & vbCrLf)
strBody.Append("Phone: " & txtPhone.Text & vbCrLf)
strBody.Append("Fax: " & txtFax.Text & vbCrLf)
'Drop down list right here strBody.Append("More Info: " & ddlInfo.SelectedValue & vbCrLf)
strBody.Append("Comments: " & txtComments.Text & vbCrLf)
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.
Re: [02/03] Drop down list error
On which line? I'm guessing one of those controls doesn't exist.
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.