473,385 Members | 1,927 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,385 software developers and data experts.

Create a component

Hi people,

I have a .vb file and I want to create a .dll file.

I'm puting this line in command line:
vbc /t:library
/r:system.dll,system.web.dll,system.data.dll,micros oft.visualbasic.dll
C:\marcacao.vb

The compiler give me errors only because I have both Response and Request
objects in my .vb file.
What do I have to add more in command line?

--
Thanks (if you help me)
Hope this helps (if I help you)

ruca
Nov 18 '05 #1
2 1141
Because you are compiling into a DLL, the DLL doesn't have access to
the response and request objects by default. You have two options.

1.) You could reference system.web.httpcontext.current in your DLL,
which would be the simplest.

2.) Create a class to manage the ASP objects for your DLL, for
example

Imports System
Imports System.Web
Imports System.web.httpcontext
Imports System.Web.SessionState

Public Class ASPObjects
'************************************************* ********
'Use this class to reference ASP.Net objects inside a .NET dll
'i.e. Application, Session, Response, Request, etc.
'************************************************* ********
Public objHttpContext As HttpContext

Public objHttpResponse As HttpResponse
Public objHttpRequest As HttpRequest
Public objHttpApplication As HttpApplicationState
Public objhttpSession As HttpSessionState
'Public strUserAgent As String

Public Sub New()

' Get the HttpContext object for the current HTTP request.
objHttpContext = HttpContext.Current()

' Get the Application State object.
objHttpApplication = objHttpContext.Application

' Get the Session object.
objhttpSession = objHttpContext.Session

' Get the Response object.
objHttpResponse = objHttpContext.Response

' Get the Request object.
objHttpRequest = objHttpContext.Request

' This code uses the Request object.
' You can use other intrinsic objects in a similar fashion
'strUserAgent =
objHttpRequest.ServerVariables("HTTP_USER_AGENT")

' This code uses the Response object.
'objHttpResponse.Write("HTTP USER AGENT: ")
'objHttpResponse.Write(strUserAgent)
end sub
End Class

Do either of these and you'll be able to access the ASP objects,

Neil
"ruca" <ru***@iol.pt> wrote in message news:<ej**************@TK2MSFTNGP11.phx.gbl>...
Hi people,

I have a .vb file and I want to create a .dll file.

I'm puting this line in command line:
vbc /t:library
/r:system.dll,system.web.dll,system.data.dll,micros oft.visualbasic.dll
C:\marcacao.vb

The compiler give me errors only because I have both Response and Request
objects in my .vb file.
What do I have to add more in command line?

Nov 18 '05 #2
It doesn't worked

Any more solutions???
--
Thanks (if you help me)
Hope this helps (if I help you)

ruca

"nfedin" <nf****@programmer.net> escreveu na mensagem
news:ca**************************@posting.google.c om...
Because you are compiling into a DLL, the DLL doesn't have access to
the response and request objects by default. You have two options.

1.) You could reference system.web.httpcontext.current in your DLL,
which would be the simplest.

2.) Create a class to manage the ASP objects for your DLL, for
example

Imports System
Imports System.Web
Imports System.web.httpcontext
Imports System.Web.SessionState

Public Class ASPObjects
'************************************************* ********
'Use this class to reference ASP.Net objects inside a .NET dll
'i.e. Application, Session, Response, Request, etc.
'************************************************* ********
Public objHttpContext As HttpContext

Public objHttpResponse As HttpResponse
Public objHttpRequest As HttpRequest
Public objHttpApplication As HttpApplicationState
Public objhttpSession As HttpSessionState
'Public strUserAgent As String

Public Sub New()

' Get the HttpContext object for the current HTTP request.
objHttpContext = HttpContext.Current()

' Get the Application State object.
objHttpApplication = objHttpContext.Application

' Get the Session object.
objhttpSession = objHttpContext.Session

' Get the Response object.
objHttpResponse = objHttpContext.Response

' Get the Request object.
objHttpRequest = objHttpContext.Request

' This code uses the Request object.
' You can use other intrinsic objects in a similar fashion
'strUserAgent =
objHttpRequest.ServerVariables("HTTP_USER_AGENT")

' This code uses the Response object.
'objHttpResponse.Write("HTTP USER AGENT: ")
'objHttpResponse.Write(strUserAgent)
end sub
End Class

Do either of these and you'll be able to access the ASP objects,

Neil
"ruca" <ru***@iol.pt> wrote in message

news:<ej**************@TK2MSFTNGP11.phx.gbl>...
Hi people,

I have a .vb file and I want to create a .dll file.

I'm puting this line in command line:
vbc /t:library
/r:system.dll,system.web.dll,system.data.dll,micros oft.visualbasic.dll
C:\marcacao.vb

The compiler give me errors only because I have both Response and Request objects in my .vb file.
What do I have to add more in command line?

Nov 18 '05 #3

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

Similar topics

3
by: Alan | last post by:
Gidday people, I had a bit of a problem this morning. I think I've got it sorted now, but I wonder if anyone can shed some light. I have a plain VBS WHS file that instantiates a component that...
3
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
2
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class...
20
by: Gary Manigian | last post by:
I have 2 tables, one-to-many, that contain bills of material(BOMs): tblBOM: lngBOMID (PK) strAssemblyPartNo strDescription tblBOMDetail: lngBOMDetailID (PK) lngBOMID (FK)
2
by: Marcin Grzębski | last post by:
Hi All, How to create *component* class which do now show its instance in a component bar? I want to create other class, this *component* instance collection and i know how to show that...
1
by: Zhou Jingxiong | last post by:
Hi I am using third party COM component which come with an installation program (.exe file included). The program will be register to registry automatically upon installation. There is no...
2
by: Fredrik Rodin | last post by:
All, I've been looking around for a solution to my problem for a couple of days now. In short, here's my situation: 1. I'm getting a result from a component back as a datatable and I have...
2
by: Ellis Yu | last post by:
Hi all, Thanks for Jim M and Herfried K Wagner first. I'd posted a question here about building dll output file in standand edition. It works after changing outputtype to "library". And now I...
7
by: jwang | last post by:
I am trying to instantiate a COM component in C# via late binding. The component appears to be launched, then it automatically gets unloaded. That is, the instance is unloaded after the...
2
by: L Gopi | last post by:
Hi! I have created a com component using framework 1.1. This component will be installed on the users machine. This component will be used by my 2.0 web application. A javascript call is made to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.