T
TN Bella
Hello,
I don't know why I keep getting this error. I have 15 of each txtacctnum
(txtacctnum - txtacctnum14), txtcostcntr, txtrefnum, and txtacctamt.
Some of the inputs are null, so I don't want to display unless there is
a value. Can someone please help?
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.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Here is my code:
Dim index as Integer
For index=0 To 14
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtAcctNum" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Cost Center</b>: " &
CType(Me.FindControl("txtCostCntr" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtRefNum" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtActAmt" & index.ToString()), TextBox).text &
"<br>"
Next
Thank you.
I don't know why I keep getting this error. I have 15 of each txtacctnum
(txtacctnum - txtacctnum14), txtcostcntr, txtrefnum, and txtacctamt.
Some of the inputs are null, so I don't want to display unless there is
a value. Can someone please help?
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.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Here is my code:
Dim index as Integer
For index=0 To 14
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtAcctNum" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Cost Center</b>: " &
CType(Me.FindControl("txtCostCntr" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtRefNum" & index.ToString()), TextBox).text &
"<br>"
litResponse.text +="<b>Account Number</b>: " &
CType(Me.FindControl("txtActAmt" & index.ToString()), TextBox).text &
"<br>"
Next
Thank you.