C# 无法使用VB,因为已指定另一种语言
我一直在尝试在一个直到最近还可以正常工作的页面上解决这个错误。我想知道是否有人能帮我找出这个错误的原因,因为我已经尽我所能修复它,但没有成功 错误消息:C# 无法使用VB,因为已指定另一种语言,c#,vb.net,visual-studio,visual-studio-2012,compiler-errors,C#,Vb.net,Visual Studio,Visual Studio 2012,Compiler Errors,我一直在尝试在一个直到最近还可以正常工作的页面上解决这个错误。我想知道是否有人能帮我找出这个错误的原因,因为我已经尽我所能修复它,但没有成功 错误消息: <%@ Control CodeBehind="address.ascx.cs" Language="c#" AutoEventWireup="false" Inherits="Inventory1.address" %> <Script language="VB" runat="Server"> Pu
<%@ Control CodeBehind="address.ascx.cs" Language="c#" AutoEventWireup="false" Inherits="Inventory1.address" %>
<Script language="VB" runat="Server">
Public Property Address1 as string
Get
Return txtAddress1.text
End Get
Set
txtAddress1.text = value
End Set
End property
Public Property Address2 as string
Get
Return txtAddress2.text
End Get
Set
txtAddress2.text = value
End Set
End property
Public Property city as string
Get
Return txtcity.text
End Get
Set
txtcity.text = value
End Set
End property
Public Property state as string
Get
Return cbostate.selecteditem.text
End Get
Set
cbostate.selectedindex = value
End Set
End property
Public Property zip as string
Get
Return txtzip.text
End Get
Set
txtzip.text = value
End Set
End property
Public Property country as string
Get
Return cbocountry.selecteditem.text
End Get
Set
cbocountry.selectedindex = value
End Set
End property
Public Property phone1 as string
Get
Return txtphone1.text
End Get
Set
txtphone1.text = value
End Set
End property
Public Property phone2 as string
Get
Return txtphone2.text
End Get
Set
txtphone2.text = value
End Set
End property
Public Property mobile as string
Get
Return txtmobile.text
End Get
Set
txtmobile.text = value
End Set
End property
Public Property email as string
Get
Return txtemail.text
End Get
Set
txtemail.text = value
End Set
End property
Public Property fax as string
Get
Return txtfax.text
End Get
Set
txtfax.text = value
End Set
End property
Public Property pager as string
Get
Return txtpager.text
End Get
Set
txtpager.text = value
End Set
End property
</Script>
错误27无法使用“VB”,因为已指定另一种语言
本页前面的内容(或从代码文件中暗示)
属性)。W:\admin.fctl.ucf.edu\inventory\old\address.ascx 2
我的代码:
<%@ Control CodeBehind="address.ascx.cs" Language="c#" AutoEventWireup="false" Inherits="Inventory1.address" %>
<Script language="VB" runat="Server">
Public Property Address1 as string
Get
Return txtAddress1.text
End Get
Set
txtAddress1.text = value
End Set
End property
Public Property Address2 as string
Get
Return txtAddress2.text
End Get
Set
txtAddress2.text = value
End Set
End property
Public Property city as string
Get
Return txtcity.text
End Get
Set
txtcity.text = value
End Set
End property
Public Property state as string
Get
Return cbostate.selecteditem.text
End Get
Set
cbostate.selectedindex = value
End Set
End property
Public Property zip as string
Get
Return txtzip.text
End Get
Set
txtzip.text = value
End Set
End property
Public Property country as string
Get
Return cbocountry.selecteditem.text
End Get
Set
cbocountry.selectedindex = value
End Set
End property
Public Property phone1 as string
Get
Return txtphone1.text
End Get
Set
txtphone1.text = value
End Set
End property
Public Property phone2 as string
Get
Return txtphone2.text
End Get
Set
txtphone2.text = value
End Set
End property
Public Property mobile as string
Get
Return txtmobile.text
End Get
Set
txtmobile.text = value
End Set
End property
Public Property email as string
Get
Return txtemail.text
End Get
Set
txtemail.text = value
End Set
End property
Public Property fax as string
Get
Return txtfax.text
End Get
Set
txtfax.text = value
End Set
End property
Public Property pager as string
Get
Return txtpager.text
End Get
Set
txtpager.text = value
End Set
End property
</Script>
作为字符串的公共属性Address1
得到
返回txtAddress1.text
结束
设置
txtAddress1.text=值
端集
端属性
公共属性Address2作为字符串
得到
返回txtdress2.text
结束
设置
txtAddress2.text=值
端集
端属性
作为字符串的公共财产城市
得到
返回txtcity.text
结束
设置
txtcity.text=值
端集
端属性
公共属性状态为字符串
得到
返回cbostate.selecteditem.text
结束
设置
cbostate.selectedindex=值
端集
端属性
公共属性压缩为字符串
得到
返回txtzip.text
结束
设置
txtzip.text=值
端集
端属性
作为字符串的公共财产国家
得到
返回cbocontry.selecteditem.text
结束
设置
cbocountry.selectedindex=值
端集
端属性
公共属性phone1作为字符串
得到
返回txtphone1.text
结束
设置
txtphone1.text=值
端集
端属性
公共属性phone2作为字符串
得到
返回txtphone2.text
结束
设置
txtphone2.text=值
端集
端属性
公共财产作为字符串移动
得到
返回txtmobile.text
结束
设置
txtmobile.text=值
端集
端属性
公共属性电子邮件作为字符串
得到
返回txtemail.text
结束
设置
txtemail.text=值
端集
端属性
公共属性传真为字符串
得到
返回txtfax.text
结束
设置
txtfax.text=值
端集
端属性
作为字符串的公共属性页导航
得到
返回txtpager.text
结束
设置
txtpager.text=值
端集
端属性
使用以下链接将vb.net转换为C#,这样您就不用担心了
或:
为什么不把VB代码编译成一个库(.dll)。以后从代码中引用它,就这样了。托管DLL包含c#和vb都编译到的MSIL使用以下链接将vb.net转换为c#,这样您就不用担心了 或: 为什么不把VB代码编译成一个库(.dll)。以后从代码中引用它,就这样了。托管DLL包含c#和vb都编译到的MSIL您的代码在c#中:
您的代码隐藏在C中:
我想你指的是C,而不是C。在这里使用C代码一点用都没有。然而在你的帖子中你说的是C,不是C。你应该解决这个问题。另外,澄清问题不属于答案,它们属于评论。至于你的第二点,这在这里是不可能的。其思想是将单个标记/代码隐藏文件编译成单个类,并且不能用多种语言定义单个类。您不能在外部库中定义类的一部分,特别是在每个部分都引用另一部分的情况下。真的没有办法转换一个或另一个,使它们都在同一种语言中。我想你是指C,而不是C。在这里使用C代码一点用处都没有。然而在你的帖子中你说的是C,不是C。你应该解决这个问题。另外,澄清问题不属于答案,它们属于评论。至于你的第二点,这在这里是不可能的。其思想是将单个标记/代码隐藏文件编译成单个类,并且不能用多种语言定义单个类。您不能在外部库中定义类的一部分,特别是在每个部分都引用另一部分的情况下。真的没有办法将其中一种转换为同一种语言。