473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Variable & storing

yop
Hello

I have an application, Login page, enter UserName &
Password.
Function in Users called GetUserDetails and checks the
details and if they are valid calls a function to fill
the following in the class component called

Public Class UserDetails
Public UserID As Integer
Public UserName As String
Public FullName As String
Public Email As String
End Class

So I would have thought now that what ever page I goto
that I could retreive the email or fullname from the
class above without having the call the GetUserDetails.

I use the following code.

'Load the User Name textbox
Dim userDetails As New
ASPNET.ASSETREG ISTER.UserDetai ls()
msgfullname.Tex t = " Logged In: " &
userDetails.Ful lName

But it does not fill it, any ideas?
thanks in advance
Nov 17 '05 #1
3 1445
Once you fill the object, where are you storing it? In session? Serialized
to disk? Not at all?

Since you are simply creating a group of properties/fields a struct might be
a better option, but you still have to store it:

Dim MyClass As UserDetails = new UserDetails()
'lines to fill class here
Session("MyClas s") = MyClass

To use:
Dim MyClass as UserDetails = CType(Session(" MyClass"), MyClass)

You could make a static class to hold the variables, but you could only have
one user at a time. Then, your code would work without saving the object
off.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

*************** *************** *************** *************** *************** *
****
Think Outside the Box!
*************** *************** *************** *************** *************** *
****
"yop" <ai*******@ocea nfree.net> wrote in message
news:06******** *************** *****@phx.gbl.. .
Hello

I have an application, Login page, enter UserName &
Password.
Function in Users called GetUserDetails and checks the
details and if they are valid calls a function to fill
the following in the class component called

Public Class UserDetails
Public UserID As Integer
Public UserName As String
Public FullName As String
Public Email As String
End Class

So I would have thought now that what ever page I goto
that I could retreive the email or fullname from the
class above without having the call the GetUserDetails.

I use the following code.

'Load the User Name textbox
Dim userDetails As New
ASPNET.ASSETREG ISTER.UserDetai ls()
msgfullname.Tex t = " Logged In: " &
userDetails.Ful lName

But it does not fill it, any ideas?
thanks in advance

Nov 17 '05 #2
yop
Ok to be honest I am not sure where they are stored, in
the class.
The class is not been stored in the session. I do not
realise that you could to be honest

thanks

-----Original Message-----
Once you fill the object, where are you storing it? In session? Serializedto disk? Not at all?

Since you are simply creating a group of properties/fields a struct might bea better option, but you still have to store it:

Dim MyClass As UserDetails = new UserDetails()
'lines to fill class here
Session("MyCla ss") = MyClass

To use:
Dim MyClass as UserDetails = CType(Session(" MyClass"), MyClass)
You could make a static class to hold the variables, but you could only haveone user at a time. Then, your code would work without saving the objectoff.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************** *************** *************** ************* *************** ********
Think Outside the Box!
************** *************** *************** ************* *************** ********
"yop" <ai*******@ocea nfree.net> wrote in message
news:06******* *************** ******@phx.gbl. ..
Hello

I have an application, Login page, enter UserName &
Password.
Function in Users called GetUserDetails and checks the
details and if they are valid calls a function to fill
the following in the class component called

Public Class UserDetails
Public UserID As Integer
Public UserName As String
Public FullName As String
Public Email As String
End Class

So I would have thought now that what ever page I goto
that I could retreive the email or fullname from the
class above without having the call the GetUserDetails.

I use the following code.

'Load the User Name textbox
Dim userDetails As New
ASPNET.ASSETREG ISTER.UserDetai ls()
msgfullname.Tex t = " Logged In: " &
userDetails.Ful lName

But it does not fill it, any ideas?
thanks in advance

.

Nov 17 '05 #3
When you load a class, it goes out of scope as soon as the page finishes
processing. If you try to pull that class on another page, it has no values,
as it is a new instance.

If you want to use an object across multiple pages, you need to store it
somewhere. Using Session is the easiest method, but you can serialize the
object and create your own engine, if there is some reason session is
unusable. Recreating the wheel is a pain, however, so I would stick to
Session before rewriting the mechanism.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

*************** *************** *************** *************** *************** *
****
Think Outside the Box!
*************** *************** *************** *************** *************** *
****
"yop" <ai*******@ocea nfree.net> wrote in message
news:0b******** *************** *****@phx.gbl.. .
Ok to be honest I am not sure where they are stored, in
the class.
The class is not been stored in the session. I do not
realise that you could to be honest

thanks

-----Original Message-----
Once you fill the object, where are you storing it? In

session? Serialized
to disk? Not at all?

Since you are simply creating a group of

properties/fields a struct might be
a better option, but you still have to store it:

Dim MyClass As UserDetails = new UserDetails()
'lines to fill class here
Session("MyCla ss") = MyClass

To use:
Dim MyClass as UserDetails = CType(Session(" MyClass"),

MyClass)

You could make a static class to hold the variables, but

you could only have
one user at a time. Then, your code would work without

saving the object
off.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************** *************** *************** *************

*************** ****
****
Think Outside the Box!
************** *************** *************** *************

*************** ****
****
"yop" <ai*******@ocea nfree.net> wrote in message
news:06******* *************** ******@phx.gbl. ..
Hello

I have an application, Login page, enter UserName &
Password.
Function in Users called GetUserDetails and checks the
details and if they are valid calls a function to fill
the following in the class component called

Public Class UserDetails
Public UserID As Integer
Public UserName As String
Public FullName As String
Public Email As String
End Class

So I would have thought now that what ever page I goto
that I could retreive the email or fullname from the
class above without having the call the GetUserDetails.

I use the following code.

'Load the User Name textbox
Dim userDetails As New
ASPNET.ASSETREG ISTER.UserDetai ls()
msgfullname.Tex t = " Logged In: " &
userDetails.Ful lName

But it does not fill it, any ideas?
thanks in advance

.

Nov 17 '05 #4

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

Similar topics

12
3301
by: Bill | last post by:
For my personal use I am accessing a railway timetable page, parsing its contents and then sending brief relevant information as the subject line of an email to be read on a mobile phone. The problem comes when I try to parse a second page, the url of which, I have derived from an initial page. I cannot go directly to the second (target) page but from the initial page derive the url and put it in a string called $strTarget In one...
2
3664
by: Fan of P2P | last post by:
Hi, Does anyone know how I can store files (mostly pictures) into a mySQL table? I have tried the load_file function but it seems to not work. i just get NULL as the value. Any examples would be most appreciated. I am using RH9 and the latest version of mySQL. I know I should be storing the links on disk and the save a pointer in
27
3824
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get failed assertions for assertions that at first thought ought to hold, but that's not important.) At the end is a full program containing the above seemingly
7
2162
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've got is a decodeImage.aspx page that gets called to decode base64 encoded images and return them as displayable images to a Web page. The ASPX page is passed two parameters, "file" and "img". The "file" parameter specifies and XML file on the Web...
41
10657
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query = String.Format("SELECT * FROM dbo.documents WHERE ") & query End Sub
1
1312
by: Martin Widmer | last post by:
Hi guys I am wondering what is a proper way to persistently store objects into SQL-Server. I see four possible ways: 1.) Serialize to XML and then store the XML in the SQL server 2.) Write a new serializer that serializes the object by storing each attribute value into a matching field in an SQL server table while performing data type mapping and possibly compression etc... 3.) For each class write a proxy class who's objects are...
11
6422
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved and
3
444
by: Markus Schuster | last post by:
Hi, I have the following javascript function: <script type="text/javascript"> function HTMLEncode( text ) { text = text.replace(/&/g, "&amp;") ; text = text.replace(/"/g, "&quot;") ;
3
2036
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve the information it contained on another page. This was significant because I am initially loading the data from the database, then storing relevent information in the object, I am allowing users to change the data then preview the modifications...
0
8397
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.