1

最近まで正常に動作していたページで、このエラーのトラブルシューティングを試みています。このエラーを修正するためにできる限りのことを試みましたが、成功しなかったため、誰かがこのエラーの原因を特定するのを手伝ってくれるかどうか疑問に思っていました.

エラーメッセージ:

エラー 27 別の言語がこのページの前半で指定されている (または CodeFile 属性から暗示されている) ため、'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>
4

2 に答える 2

5

コード ビハインドは C# です。

<%@ Control CodeBehind="address.ascx.cs" Language="c#" 

そのため、VB コードではなく、C# コードのみをページに埋め込むことができます。コード ビハインドと埋め込みスクリプトレットの両方に完全に VB を使用するか、両方の場合に完全に C# を使用します。

于 2013-02-27T17:20:29.370 に答える
0

次のリンクを使用して vb.net を C# に変換すると、心配する必要はありません。

VB から C# へのコンバーター

また:

VB コードをライブラリ (.dll) にコンパイルしてみませんか。後でコードから参照すれば、それだけです。マネージ dll には、c# と vb の両方がコンパイルされる MSIL が含まれています。

于 2013-02-27T17:20:26.507 に答える