.ascx file erro need some help

I create a .ascx file where I have a form, but when I load my .aspx page, on the page_load event I have setup some text to give some value to the forms in the .ascx file, but I'm getting this error msg.

Server Error in '/' Application.

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30390: '_ASP.babysitter_ascx.txtfname' is not accessible in this context because it is 'Protected'.

Source Error:


Line 7:              myConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/database/babysitter.mdb") & ";")
Line 8:              myConn.Open()
Line 9:              babysitterform1.txtfname.Text = "Ennio"
Line 10:             
Line 11:             myConn.Close()
And here is my .ASPX file

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="bsf" TagName="babysitterform" src="babysitter.ascx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web.Security" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script language="vb"  runat="server">

Sub Page_Load( S As Object, E As EventArgs)
      If Not isPostBack Then
            babysitterform1.txtfname.Text = "Ennio"
      End If
End Sub

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<form runat="server">
<bsf:babysitterform ID="babysitterform1" runat="server" />
Who is Participating?
DabasConnect With a Mentor Commented:
Just double click anywhere within your design screen

Hi Ennio:
Have a look at the declaration of txtfnname in the code behind
Change its declaration to Public

EnnioAuthor Commented:
Hi Dabas,
I was looking on my .ascx and I think I did something wrong, I don't have any declaretion... Here is the .ascx file

First Name: <asp:TextBox ID="txtfname" runat="server" /><br />
Last Name: <asp:TextBox ID="txtlname" runat="server" /><br />

How should I declare this?? I was look in a book, but it really doesn't show how to do that.
it just tell me do add some fields
NOT in the .ascx but in the .ascx.vb

EnnioAuthor Commented:
hum.. I don't have one, this book really Su.....

Do you know where can I find some information about it?
What I should have on my .ascx.vb??
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.