|
-
Apr 30th, 2003, 04:05 AM
#1
Thread Starter
New Member
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
-
Apr 30th, 2003, 07:30 AM
#2
Junior Member
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
-
Apr 30th, 2003, 10:06 AM
#3
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.
-
Apr 30th, 2003, 10:26 AM
#4
Sleep mode
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|