473,408 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

calling class library from ASP.net

Hi Frens,
I've made a class library project in Visual Basic using
visual studio.net 2003. Now after i m done I copy the dll
from the \bin dir. of this project to my web application
project using ASP.net 's bin dir to use it.
and Then I am trying to use this dll in my .aspx page but
it gives me error message that object not defined. I
searched on internet for around 2 days but nothin worked
out.
So If anyone can solve my problem it'll eb gr8 help for me.

Thanks,
Alpesh Parmar
Nov 17 '05 #1
3 1913
Alpesh,

You need to add a reference to the .dll in your project's references folder.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Alpesh Parmar" <al*************@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Hi Frens,
I've made a class library project in Visual Basic using
visual studio.net 2003. Now after i m done I copy the dll
from the \bin dir. of this project to my web application
project using ASP.net 's bin dir to use it.
and Then I am trying to use this dll in my .aspx page but
it gives me error message that object not defined. I
searched on internet for around 2 days but nothin worked
out.
So If anyone can solve my problem it'll eb gr8 help for me.

Thanks,
Alpesh Parmar

Nov 17 '05 #2
Hi Justin,
I tried this way also. I put it in refrence library but whenever i m
trying to access class from that .dll file it gives me compiler error
saying

I m pasting the source code for the dll and the application too plzz
check it out and let me know.

This is Webform1.aspx file:

<%@ Page Language="VB"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="DOTNETMath" %>

<script runat="server" language="VB">
Sub Page_Load(sender As Object, evtArgs As EventArgs)
Dim MathComponent = New Operations()
Dim AddResult, SubResult As Single
AddResult = MathComponent.Add(CSng(FirstNum), CSng(SecondNum))
SubResult = MathComponent.Subs(CSng(FirstNum), CSng(SecondNum))
end sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>
----------------------------------------------------------

this is DOTNETMath.dll file:

mports System
Imports Microsoft.VisualBasic

Namespace DOTNETMath
Public Class Operations

Public Sub New()
MyBase.New()
End Sub

Public Function Add(ByVal A As Single, ByVal B As Single) As
Single
Add = A + B
End Function

Public Function Subs(ByVal A As Single, ByVal B As Single) As
Single
Subs = A - B
End Function

Public Function Mul(ByVal A As Single, ByVal B As Single) As
Single
Mul = A * B
End Function

Public Function Div(ByVal A As Single, ByVal B As Single) As
Single
If B = 0 Then
Div = -1
Else
Div = A / B
End If
End Function

End Class
End Namespace
-----------------------------------------------------------
Plzz try to run this and let me know. I m waiting for ur answer and tell
me the exact procedure to do it.

Thanks,
Alpesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
Alphesh,

What does MyBase.New() in the components constructor refer to. This would
typically be used if you are inheriting another class into this component,
but I don't see an Inherits statement.

If this component is not inheriting from another you can safely remove the
entire constructor:

Public Sub New()
MyBase.New()
End Sub

since it doesn't do anything anyway.

I believe that the "Object is not defined" error is referring to the missing
MyBase.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Alpesh Parmar" <al*************@hotmail.com> wrote in message
news:O1**************@TK2MSFTNGP10.phx.gbl...
Hi Justin,
I tried this way also. I put it in refrence library but whenever i m
trying to access class from that .dll file it gives me compiler error
saying

I m pasting the source code for the dll and the application too plzz
check it out and let me know.

This is Webform1.aspx file:

<%@ Page Language="VB"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="DOTNETMath" %>

<script runat="server" language="VB">
Sub Page_Load(sender As Object, evtArgs As EventArgs)
Dim MathComponent = New Operations()
Dim AddResult, SubResult As Single
AddResult = MathComponent.Add(CSng(FirstNum), CSng(SecondNum))
SubResult = MathComponent.Subs(CSng(FirstNum), CSng(SecondNum))
end sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

</form>

</body>
</html>
----------------------------------------------------------

this is DOTNETMath.dll file:

mports System
Imports Microsoft.VisualBasic

Namespace DOTNETMath
Public Class Operations

Public Sub New()
MyBase.New()
End Sub

Public Function Add(ByVal A As Single, ByVal B As Single) As
Single
Add = A + B
End Function

Public Function Subs(ByVal A As Single, ByVal B As Single) As
Single
Subs = A - B
End Function

Public Function Mul(ByVal A As Single, ByVal B As Single) As
Single
Mul = A * B
End Function

Public Function Div(ByVal A As Single, ByVal B As Single) As
Single
If B = 0 Then
Div = -1
Else
Div = A / B
End If
End Function

End Class
End Namespace
-----------------------------------------------------------
Plzz try to run this and let me know. I m waiting for ur answer and tell
me the exact procedure to do it.

Thanks,
Alpesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
13
by: RainBow | last post by:
Hi everyone, (Very Sorry, if this is the wrong group in which I am posting this query). Code snippet: //C library typedef int (*PFunc)(int* aArg); void call_c_foo(PFunc aPtrtoFunc) {
11
by: j23 | last post by:
I have library (static) testlib.cpp: #include <stdarg.h> void xxx(...) { char buf; va_list args; va_start(args, buf); va_end(args); }
5
by: Bennett Haselton | last post by:
I've noticed that if you enter the following code in the codebehind page for an .aspx page, it won't compile because the call to Trace.Write() is not valid except in methods of a class derived from...
1
by: JezB | last post by:
In my Page_Load event of all my web app Pages and UserControls I instantiate the same library class "TextResources" (to take care of reading presentation text strings from localizable resource...
7
by: John | last post by:
Hi I have two distinct classes A & B. I am using class B from within Class A as follows; Public Class clsClassA Friend ClassB As new ClassB Public Sub New()
6
by: Amjad | last post by:
Hi, I want to make a project that calls and executes a function (VB code) made in a seperate file in the Application Folder. I know I can create the function in my project and call it internally,...
0
by: ASP Developer | last post by:
I would like to be able to set my connection strings and other settings in my class library. Then when a calling application calls my library I can use those settings to query my database etc. ...
2
by: Dragan | last post by:
Hi, We're working in VS 2005, Team edition, if it makes any difference at all (should be up-to-date and all that, but could not guarantee it is 100%). We've implemented a simple generic wrapper...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.