Problem accessing User Control fields...

  • Thread starter Thread starter Lynn
  • Start date Start date
L

Lynn

Hello,

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:
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
 
Hello,

Thanks for the prompt reply. :)

I was pretty sure I had everything in place correctly, as I was able to get
intellisense to show the exposed fields in the user control.

Anyhow, since it was such a small control, I rebuilt it from scratch, and
inserted into the html again, and it appears to be working fine now. Go
figure.

Thanks!

Lynn
 
Back
Top