compile a class

Last post 06-29-2009 12:29 PM by slick_ns. 5 replies.

Sort Posts:

  • compile a class

    08-10-2008, 8:35 PM
    • Member
      263 point Member
    • mattock
    • Member since 09-04-2006, 12:26 PM
    • Bournemouth, UK
    • Posts 132

    Hi

    I'm following an article (here) and stuck on the following:

     

    "Once you have created this class and compiled it, to use it in an ASP.NET Web application, start by adding it to the Web application's References folder."

     

    Ok, so do i now need to compile my vb class file into a .dll and reference it from the BIN folder?  If so how do i compile the vb file?  I'm running VS 2005 .net 2.0

     cheers
     

  • Re: compile a class

    08-10-2008, 9:22 PM
    • Star
      8,079 point Star
    • Ken Tucker
    • Member since 12-23-2003, 1:40 PM
    • Port St. John, Florida
    • Posts 1,216
    • TrustedFriends-MVPs

    In the build menu select build.  It will compile the code into a dll.

  • Re: compile a class

    08-11-2008, 3:58 AM
    • Member
      263 point Member
    • mattock
    • Member since 09-04-2006, 12:26 PM
    • Bournemouth, UK
    • Posts 132

     Hi

    I have put my .vb class file into the Bin, how ever when i go to 'Build/Build Website' i get errors that it can't see the class, eg:

    "Could not load file or assembly 'ActionlessForm' or one of its dependencies. The system cannot find the file specified."


     Don't i need to compile it separately then add it as a reference?

     

    cheers 

  • Re: compile a class

    08-11-2008, 1:49 PM
    • Star
      8,432 point Star
    • cv_vikram
    • Member since 07-04-2006, 1:33 PM
    • Earth
    • Posts 1,047

    Friend, Compile that class separatley and then add the reference to that dll. That will solve the problem.

     

    Please Don't forget to click "Mark as Answer" on the post that helped you.
    This can be beneficial to other community members reading the thread.
  • Re: compile a class

    08-11-2008, 3:47 PM
    • Member
      263 point Member
    • mattock
    • Member since 09-04-2006, 12:26 PM
    • Bournemouth, UK
    • Posts 132

    hi

    I tried creating a new class library project, but it comes up with errors when i try to compile the follwoing:

     

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web;
    
    namespace ActionlessForm
    {
        public class Form : System.Web.UI.HtmlControls.HtmlForm
        {
            protected override void RenderAttributes(HtmlTextWriter writer)
            {
                writer.WriteAttribute("name", this.Name);
                base.Attributes.Remove("name");
    
                writer.WriteAttribute("method", this.Method);
                base.Attributes.Remove("method");
    
                this.Attributes.Render(writer);
    
                base.Attributes.Remove("action");
    
                if (base.ID != null)
                    writer.WriteAttribute("id", base.ClientID);
            }
        }
    }

     
     ....and i get the following errors:

     Error    1    The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)    C:\Documents and Settings\G Mattock\My Documents\Visual Studio 2005\Projects\ISAPIReWritePostBack\ISAPIReWritePostBack\Class1.cs    8    36    ISAPIReWritePostBack


    Error    2    The type or namespace name 'HtmlTextWriter' could not be found (are you missing a using directive or an assembly reference?)    C:\Documents and Settings\G Mattock\My Documents\Visual Studio 2005\Projects\ISAPIReWritePostBack\ISAPIReWritePostBack\Class1.cs    10    50    ISAPIReWritePostBack
     

  • Re: compile a class

    06-29-2009, 12:29 PM
    • Member
      2 point Member
    • slick_ns
    • Member since 06-29-2009, 12:26 PM
    • Posts 1

    Please let me know if you got any answers on this question.
    I got stuck at this exact point too.
    Thx  

Page 1 of 1 (6 items)