Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net vb.net错误:由于其保护级别而无法访问_Asp.net_Vb.net_Visual Studio 2010 - Fatal编程技术网

Asp.net vb.net错误:由于其保护级别而无法访问

Asp.net vb.net错误:由于其保护级别而无法访问,asp.net,vb.net,visual-studio-2010,Asp.net,Vb.net,Visual Studio 2010,我是第一次使用vb.net代码,但我有5年的C#工作经验 以前的开发人员告诉我,服务器上的代码运行良好,没有任何错误,但当我打开网站文件夹(网站没有解决方案文件)时,我尝试构建网站,但我收到了大量错误,如: 未声明“labelControl”。它可能由于其自身的原因而无法访问 保护级别 到目前为止,我打开的两个页面上的所有控件都是这样 以下是其中一个文件的部分标记、逻辑和设计器代码: 标记: <%@ Page Title="" Language="vb" AutoEventWireup="

我是第一次使用vb.net代码,但我有5年的C#工作经验

以前的开发人员告诉我,服务器上的代码运行良好,没有任何错误,但当我打开网站文件夹(网站没有解决方案文件)时,我尝试构建网站,但我收到了大量错误,如:

未声明“labelControl”。它可能由于其自身的原因而无法访问 保护级别

到目前为止,我打开的两个页面上的所有控件都是这样

以下是其中一个文件的部分标记、逻辑和设计器代码:

标记:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="OverriedCalcValues.aspx.vb" Inherits="Homevesters.Overried_Calc_Values" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">       
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
         <table  cellpadding="5" border="1">                            
         <tr>
                  <td class="style15"><asp:label ID="lblDoorJam1" runat="server" Font-Bold="true" Text="Door Jamb"/><br />Cost per door jamb replacement</td>
                  <td class="style38"><asp:label ID="lblFactorType1" runat="server"  Text="$/Each"/></td>
                  <td class="style41"><asp:label ID="lblDoorJam" runat="server"  Text=""/></td>
                  <td class="style32"><asp:CheckBox ID="ckDoorJam" runat="server"/></td>
                  <td class="style35">$<asp:TextBox ID="txtDoorJam" runat="server"  Text="" Width="80px" /></td>
         </tr>

         <tr>
                  <td class="style16"><asp:label ID="lblExtDoor1" runat="server" Font-Bold="true"  Text="Exterior Door"/><br />Cost per exterior door replacement</td>
                  <td class="style39"><asp:label ID="lblFactorType2" runat="server"  Text="$/Each"/></td>
                  <td class="style42"><asp:label ID="lblExtDoor" runat="server"  Text=""/></td>
                  <td class="style33"><asp:CheckBox ID="ckExtDoor" runat="server"/></td>
                  <td class="style36">$<asp:TextBox ID="txtExtDoor" runat="server"  Text="" Width="80px" /></td>
         </tr>

         <tr>
                  <td class="style15"><asp:label ID="lblGarageSingle1" runat="server" Font-Bold="true" Text="Garage (1 Single)"/><br />Cost to replace one single garage door</td>
                  <td class="style38"><asp:label ID="lblFactorType3" runat="server"  Text="$/Each"/></td>
                  <td class="style41"><asp:label ID="lblGarageSingle" runat="server"  Text=""/></td>
                  <td class="style32"><asp:CheckBox ID="ckGarageSingle" runat="server"/></td>
                  <td class="style35">$<asp:TextBox ID="txtGarageSingle" runat="server"  Text="" Width="80px" /></td>
         </tr>

         <tr>
                  <td class="style16"><asp:label ID="lblGarageDouble1" runat="server" Font-Bold="true"  Text="Garage (1 Double)"/><br />Cost to replace one double garage door</td>
                  <td class="style39"><asp:label ID="lblFactorType4" runat="server"  Text="$/Each"/></td>
                  <td class="style42"><asp:label ID="lblGarageDouble" runat="server"  Text=""/></td>
                  <td class="style33"><asp:CheckBox ID="ckGarageDouble" runat="server"/></td>
                  <td class="style36">$<asp:TextBox ID="txtGarageDouble" runat="server"  Text="" Width="80px" /></td>
         </tr>


         <tr>
                  <td class="style15"><asp:label ID="Label1" runat="server" Font-Bold="true" Text="Interior Door"/><br />Cost per interior door replacement</td>
                  <td class="style38"><asp:label ID="Label2" runat="server"  Text="$/Each"/></td>
                  <td class="style41"><asp:label ID="lblInteriorDoor" runat="server"  Text=""/></td>
                  <td class="style32"><asp:CheckBox ID="ckInteriorDoor" runat="server"/></td>
                  <td class="style35">$<asp:TextBox ID="txtInteriorDoor" runat="server"  Text="" Width="80px" /></td>
         </tr>

         <tr>
                  <td class="style16"><asp:label ID="Label4" runat="server" Font-Bold="true"  Text="Patio Door"/><br />Cost to replace one patio door</td>
                  <td class="style39"><asp:label ID="Label5" runat="server"  Text="$/Each"/></td>
                  <td class="style42"><asp:label ID="lblPatioDoor" runat="server"  Text=""/></td>
                  <td class="style33"><asp:CheckBox ID="ckPatioDoor" runat="server"/></td>
                  <td class="style36">$<asp:TextBox ID="txtPatioDoor" runat="server"  Text="" Width="80px" /></td>
         </tr>

         <tr>
                  <td class="style15"><asp:label ID="Label3" runat="server" Font-Bold="true" Text="Patio Glass"/><br />Cost per patio glass replacement</td>
                  <td class="style38"><asp:label ID="Label6" runat="server"  Text="$/Each"/></td>
                  <td class="style41"><asp:label ID="lblPatioGlass" runat="server"  Text=""/></td>
                  <td class="style32"><asp:CheckBox ID="ckPatioGlass" runat="server"/></td>
                  <td class="style35">$<asp:TextBox ID="txtPatioGlass" runat="server"  Text="" Width="80px" /></td>
         </tr>



                 <tr>        
                  <td class="style16"><asp:label ID="Label7" runat="server" Font-Bold="true" Text="Dishwasher"/><br />Cost to replace one dishwasher</td>
                  <td class="style39"><asp:label ID="Label8" runat="server"  Text="$/Each"/></td>
                  <td class="style42"><asp:label ID="lblDishWasher" runat="server"  Text=""/></td>
                  <td class="style33"><asp:CheckBox ID="ckDishwasher" runat="server"/></td>
                  <td class="style36">$<asp:TextBox ID="txtDishwasher" runat="server"  Text="" Width="80px" /></td>
         </tr>                 
</table>                
</asp:Content>
设计师:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class Override_Calc_Values

    '''<summary>
    '''lblDoorJam1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDoorJam1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDoorJam As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ckDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ckDoorJam As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''txtDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDoorJam As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblExtDoor1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblExtDoor1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblExtDoor As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ckExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ckExtDoor As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''txtExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtExtDoor As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblGarageSingle1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblGarageSingle1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType3 As Global.System.Web.UI.WebControls.Label

End Class
'------------------------------------------------------------------------------
' 
'此代码是由工具生成的。
'
'对此文件的更改可能会导致不正确的行为,如果
'代码将重新生成。
' 
'------------------------------------------------------------------------------
选项严格限制在
选项显式打开
部分公共类重写计算值
'''
''lblDoorJam1控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件lblDoorJam1保护,如Global.System.Web.UI.WebControls.Label
'''
''lblFactorType1控件。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件lblFactorType1保护,如Global.System.Web.UI.WebControls.Label
'''
''lblDoorJam控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件lblDoorJam作为Global.System.Web.UI.WebControl.Label进行保护
'''
''卡门控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件ckDoorJam作为Global.System.Web.UI.WebControls.CheckBox进行保护
'''
''TXT门堵塞控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件TXTOORJAM保护,如Global.System.Web.UI.WebControls.TextBox
'''
''lblExtDoor1控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件lblExtDoor1作为Global.System.Web.UI.WebControl.Label进行保护
'''
''lblFactorType2控件。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件lblFactorType2保护,如Global.System.Web.UI.WebControls.Label
'''
''lblexto或控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件LBLEXTDO或作为Global.System.Web.UI.WebControl.Label进行保护
'''
''门控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件CKEXTOOR作为Global.System.Web.UI.WebControl.CheckBox进行保护
'''
''txtext门控制。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
使用事件txtExtDoor作为Global.System.Web.UI.WebControl.TextBox进行保护
'''
''lblGarageSingle1控件。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件lblGarageSingle1的保护,如Global.System.Web.UI.WebControls.Label
'''
''lblFactorType3控件。
'''
'''
''自动生成的字段。
''将字段声明从设计器文件修改为代码隐藏文件。
'''
受事件lblFactorType3保护,如Global.System.Web.UI.WebControls.Label
末级
以下是我遇到的一些错误:


您认为这可能是什么原因?

如果您的代码是逐字复制的,那么逻辑块中的类名拼写错误,并且与设计器文件中的名称不匹配。这导致它被解释为两个独立的类,从而导致错误。一个文件中的代码无法引用另一个文件中定义的对象。

修复逻辑块中的类名以匹配设计器块,错误就会消失。


编辑:我注意到标记文件的第一行也拼写错误。请确保也在此处修复类名。

是否更改了代码隐藏文件的命名空间,或更改了
.aspx
标记的页面指令中的Inherits=“…”。检查它们是否匹配
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class Override_Calc_Values

    '''<summary>
    '''lblDoorJam1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDoorJam1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblDoorJam As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ckDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ckDoorJam As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''txtDoorJam control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtDoorJam As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblExtDoor1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblExtDoor1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType2 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType2 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblExtDoor As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''ckExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ckExtDoor As Global.System.Web.UI.WebControls.CheckBox

    '''<summary>
    '''txtExtDoor control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents txtExtDoor As Global.System.Web.UI.WebControls.TextBox

    '''<summary>
    '''lblGarageSingle1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblGarageSingle1 As Global.System.Web.UI.WebControls.Label

    '''<summary>
    '''lblFactorType3 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents lblFactorType3 As Global.System.Web.UI.WebControls.Label

End Class