error:-Could not load type with vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #1

    error:-Could not load type with vb

    The code
    Code:
     <%@ Page Language="vb" Codefile="test3.aspx.vb" AutoEventWireup="false" Inherits="test3" %>
    is working but by using Codebehind instead of Codefile its reported error:- Could not load type 'test3'
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi jha,

    What do you mean by using codebehind rather than codefile?

    Dr B

    Comment

    • idsanjeev
      New Member
      • Oct 2007
      • 241

      #3
      Originally posted by DrBunchman
      Hi jha,
      What do you mean by using codebehind rather than codefile?
      Dr B
      i try to understand .net
      when using codebehind instead of codefile it reported error Could not load type
      why this error is reported i don't know

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Are you creating a Website or Web Application? Is there a reason why you want to use CodeBehind rather than CodeFile?

        Dr B

        Comment

        • idsanjeev
          New Member
          • Oct 2007
          • 241

          #5
          Originally posted by DrBunchman
          Are you creating a Website or Web Application? Is there a reason why you want to use CodeBehind rather than CodeFile?
          Dr B
          I am creating web application and i try to know where can use codefile and codebehind ?

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            Ok. Here's a standard ASP.NET header when you are using a CodeFile. This is what Visual Studio adds to every ASPX page you create in it when you check "Place Code in Separate File"
            Code:
            <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
            and in the codefile (default.aspx.v b)
            Code:
            Partial Class _Default
                Inherits System.Web.UI.Page
            The partial class name must be the same as the file name, and must be the same as the "Inherits" attribute of the header in the .aspx page.

            So in your case, I bet that your filename and class name aren't correct. The file should be test3.aspx.vb, and the class name in the file should be test3.

            Make sure that you are doing this. If you are uncertain, make a new page in Visual Studio, making sure to check the "Place Code in separate file" check box, and paste your code in appropriately. If you don't have Visual Studio, Microsoft distributes the Express versions for free. The one you'd want is Visual Web Developer.

            Comment

            Working...