I have the following code in global.asax.vb
Public UO As UNIOBJECTSLib()
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
UO = new UniObjectsLib()
End Sub
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
Application("MyObj") = UO
End Sub
How can I retrieve this UO obj from a page?
thanks 6 4460
"dbui" <nn*****@hotmail.com> wrote in news:#E9iN4bbEHA.3684
@TK2MSFTNGP09.phx.gbl: Application("MyObj") = UO How can I retrieve this UO obj from a page?
Dim SomeVariable as MyObj = Application("MyObj")
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
thanks Tam,
I did try that b4 posting the question and it didn't work. It gave me an
error, something like "Object instance was not set..."
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. . "dbui" <nn*****@hotmail.com> wrote in news:#E9iN4bbEHA.3684 @TK2MSFTNGP09.phx.gbl:
Application("MyObj") = UO
How can I retrieve this UO obj from a page?
Dim SomeVariable as MyObj = Application("MyObj") -- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
I think what you meant as followed:
Dim obj as MyObject = Ctype(Application("MyObj") , MyObject)
I tried that and got an error : "Server throws error exception." .
thanks
"Tampa .NET Koder" <Ta***********@discussions.microsoft.com> wrote in
message news:8D**********************************@microsof t.com... Try
Dim obj as New MyObject
obj = Ctype(Application("MyObj") , MyObject)
It is key to use the NEW opeator to create objects in memory, otherwise
you will get this error "dbui" wrote:
thanks Tam,
I did try that b4 posting the question and it didn't work. It gave me an error, something like "Object instance was not set..."
"Lucas Tam" <RE********@rogers.com> wrote in message news:Xn***************************@140.99.99.130.. . "dbui" <nn*****@hotmail.com> wrote in news:#E9iN4bbEHA.3684 @TK2MSFTNGP09.phx.gbl:
> Application("MyObj") = UO >
> > How can I retrieve this UO obj from a page?
Dim SomeVariable as MyObj = Application("MyObj") -- Lucas Tam (RE********@rogers.com) Please delete "REMOVE" from the e-mail address when replying. http://members.ebay.com/aboutme/coolspot18/
"dbui" <nn*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I have the following code in global.asax.vb
Public UO As UNIOBJECTSLib()
First, never use public fields.
Private _UO As New UNIOBJECTSLib()
Public Sub New() MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
UO = new UniObjectsLib()
You don't need the above, since I used New in the declaration.
End Sub
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
Application("MyObj") = _UO
End Sub
How can I retrieve this UO obj from a page?
Public Property UO As UNIOBJECTSLib
Get
Return DirectCast(Application("MyObj"), UNIOBJECTSLib)
End Get
End Property
Then, from a page, you can use:
Dim g As Global = DirectCast(Context.ApplicationInstance, Global)
Dim LocalUO As UNIOBJECTSLib = g.UO
--
John Saunders
johnwsaundersiii at hotmail
Hi dbui,
I think that the problem is not how you are creating your object, but
rather that you are not checking to see if the object exists in the
application. That is probably why you are getting the "Object instance not
set..." exception.
Dim obj as New MyObject
obj = CType(Application("MyObj"), MyObject)
If(obj IsNot Nothing) Then
....
End If
--
HTH
Kyril
On Mon, 19 Jul 2004 12:33:01 -0700, Tampa .NET Koder
<Ta***********@discussions.microsoft.com> wrote: Try
Dim obj as New MyObject
obj = Ctype(Application("MyObj") , MyObject)
It is key to use the NEW opeator to create objects in memory, otherwise you will get this error
"dbui" wrote:
thanks Tam,
I did try that b4 posting the question and it didn't work. It gave me an error, something like "Object instance was not set..."
"Lucas Tam" <RE********@rogers.com> wrote in message news:Xn***************************@140.99.99.130.. . > "dbui" <nn*****@hotmail.com> wrote in news:#E9iN4bbEHA.3684 > @TK2MSFTNGP09.phx.gbl: > > > Application("MyObj") = UO > > > > > > > How can I retrieve this UO obj from a page? > > Dim SomeVariable as MyObj = Application("MyObj") > > > > -- > Lucas Tam (RE********@rogers.com) > Please delete "REMOVE" from the e-mail address when replying. > http://members.ebay.com/aboutme/coolspot18/
--
--
HTH
Kyril
Thanks John
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl... "dbui" <nn*****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... I have the following code in global.asax.vb
Public UO As UNIOBJECTSLib()
First, never use public fields.
Private _UO As New UNIOBJECTSLib()
Public Sub New() MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
UO = new UniObjectsLib()
You don't need the above, since I used New in the declaration.
End Sub
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
Application("MyObj") = _UO
End Sub
How can I retrieve this UO obj from a page?
Public Property UO As UNIOBJECTSLib Get Return DirectCast(Application("MyObj"), UNIOBJECTSLib) End Get End Property
Then, from a page, you can use:
Dim g As Global = DirectCast(Context.ApplicationInstance, Global) Dim LocalUO As UNIOBJECTSLib = g.UO -- John Saunders johnwsaundersiii at hotmail
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Edward Jones |
last post by:
I want to send users to an Access Denied page rather than the Login
page when they are authenticated but not authorized to see a specific
page while using Forms based authentication in ASP.Net.
...
|
by: Me_Titus |
last post by:
I would like to know if there is any kind of difference between an empty web project and an web application project other
than all the files stucked toghether to the web application project. I am...
|
by: Ronnie |
last post by:
I've created a simple web application using VS2005 Beta 2.
Basically, I've added a Web Form and a Global.asax file.
In my Global.asax, I create a method like:
public static void TestGlobal()...
|
by: ad |
last post by:
The Global.asax is code-inside with default.
How to change Global.asax to code-behind?
|
by: daFou |
last post by:
Please help me how to access shared members in my global.asax in ASP.NET 2.0
This is what i do.
First I create a new website using VS.NET 2005. I select a location where
the website should be...
|
by: Fabio Cavassini |
last post by:
Hi,
I have made a method in Global.asax called from Application_Start event
that loads some cache data from database to Application scope objets.
This is necessary because this is some data...
|
by: romeo_a_casiple |
last post by:
I'm looking to create an static object that has application scope and
be able to access that static object from my web service.
I understand there are two ways to do this :
1) use the object...
|
by: j.t.w |
last post by:
Hi.
I'm following along with the learnvisualstudio.net videos. Everything
works in VWD but, when I upload my files to the web server, the pages
for the 3rd and 4th videos don't work.
For both...
|
by: rote |
last post by:
I'm using ASP.NET 2.0 and i have copied and pasted the code below to my
Global.asax file but it desn't trap
the error
I want to trap the 401 access denied
void Application_Error(object sender,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |