My problem is I would like to pull a value from a formview into a text box outside of the form view. It seems like it would be simple enough, but I have struggled with this for days with an error that is engrained in my memory “system.nullreferenceexception: object reference not set to an instance of an object” I have researched this error with many results, but nothing I have tried solves my problem as I keep coming back to the same error.
I would greatly appreciate some advice on how to correct my code below.
<script runat="server"> Public Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound Dim compliant As Label If FormView1.CurrentMode = FormViewMode.[ReadOnly] Then compliant = TryCast(FormView1.FindControl("label1"), Label) If Not compliant Is Nothing Then compliant.Text = "Nothing Returned" End If If compliant.Text = "Yes" Then TextBox2.Text = " Yes you passed" ElseIf compliant.Text = "No" Then TextBox2.Text = " No you did not pass" End If TextBox2.Text = compliant.Text End If End Sub </script>
This post has been edited by AdamSpeight2008: 15 August 2012 - 08:15 PM
Reason for edit:: USE THE CORRECT CODE TAG PLEASE