I have some user controls on a page...one for the user to fill in name,
address, etc., and the other for the user to fill in credit card
information.
I have built the user controls in exactly the same way in that in the code
behind page, I am using:
Public Property sCVCCode() As String
Get
Return txtSecurityCode.Text
End Get
Set(ByVal Value As String)
txtSecurityCode.Text = Value
End Set
End Property
In my aspx page, I have placed the user controls on the page, and in the
code behind for this page, I have declared my controls like this:
Protected ucRegistrantInfoWithNurse As cforums.RegisantInfoWithNurse
Protected ucPlaceOfEmploymentInfo As cforums.PlaceOfEmploymentInfo
Protected ucCreditCardInfo As cforums.CreditCardInfo
So, now in the code behind I am able to access my fields for name, address,
etc. by using:
ucHomeAddress.sAddress_1
If I set
label1.text = ucHomeAddress.sAddress_1.ToString
my page grabs the address just fine.
BUT...if I try to do this with any part of the Credit Card user control,
like this:
label1.text = ucCreditCardInfo.sCVCCode.ToString
I get the following error:
Object reference not set to an instance of an object.<<
Line 719:
Line 720: Public Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Line 721: Label4.Text = ucCreditCardInfo.sCVCCode.ToString
Any idea why I can access the information from the text fields of one user
control but not the other?
Please let me know if you need any more information.
Thank you for the help,
Lynn