Results 1 to 4 of 4

Thread: Compiling an VB.NET comprising Window Application & Class Library

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Posts
    12

    Compiling an VB.NET comprising Window Application & Class Library

    Hi,

    I have made a simple program of adding two numbers where i have defined the formula as a Function in the Class library Template.

    And

    am calling the Function from a Windows Application Template.

    When i am debugging the program the error is "A project with an output type of class library cannot be started directly".


    The code is as Below


    Class Library Template

    NAme of the file is Addittion.vb
    ------------------------------------------------------------------------------
    Namespace BondF

    Public Class Add

    Public Function Add(ByVal a As Double, ByVal b As Double) As Double

    Add = a+ b

    End Function

    End Class

    End Namespace
    -------------------------------------------------------------------------------


    Windows Application Template
    -------------------------------------------------------------------------------

    Dim Sum as Double

    Sum = Addittion.Add(1.1,2.1)
    Msgbox(Sum)

    -------------------------------------------------------------------------------

    Is there any online material explaining the intricacies of working with Class Library Template ?

    Thanx In Advance

  2. #2
    Junior Member
    Join Date
    Apr 2003
    Posts
    18
    I am asumming you started a windows application and removed the form. Class libraries cannot be started directly. Add a Module to the project and put a "sub main" in it to start the application.

    Code:
    Public Sub Main()
    
    'Your code here....
    
    end sub
    www.WinMgmt.com
    [email protected]

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You may also just loaded the Class Library Project before the Windows Application Project in the same Solution. If so then you'll see them both in the Solution Explorer and one project name will be bolded. The Bolded item is what is set as teh startup object when debugging, to change this just right click on a project and choose, 'Set as Start Up...' from the menu.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    As I involved in that much these days , I compile my class to dll files by creating console application and just attaching that class , change from debug to release . It's faster and easier .You don't have to write any line of code .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width