473,785 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to assign session object to user control

Hi all,
I have the following code, without option Strict on, it seems work OK, but
when option strict is on. I have a problem for the assignment.

Dim ctrlarr(5) As PeopleInfo 'poepleinfo is user control in project
Dim i As Integer
If Not Session("ctrlar r") Is Nothing Then
ctrlarr = Session("ctrlar r")
End If
It says option strict on disallows implicit conversion from 'system.object'
to '1-dimensional array of subway.peoplein fo'
I guess I would have the same problem when I assign
Session("ctrlar r")=ctrlarry in the first page if I turn on option Strict.
What should I do in this case?
--
Betty
Feb 14 '06 #1
3 1328
GS
You have to cast to specific type before assiging it back.
In c# it will be ctrlarr = (subway.peoplei nfo)Session("ct rlarr")
Not sure what VB cast looks like
"c676228" <be****@communi ty.nospam> wrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi all,
I have the following code, without option Strict on, it seems work OK,
but
when option strict is on. I have a problem for the assignment.

Dim ctrlarr(5) As PeopleInfo 'poepleinfo is user control in project
Dim i As Integer
If Not Session("ctrlar r") Is Nothing Then
ctrlarr = Session("ctrlar r")
End If
It says option strict on disallows implicit conversion from
'system.object'
to '1-dimensional array of subway.peoplein fo'
I guess I would have the same problem when I assign
Session("ctrlar r")=ctrlarry in the first page if I turn on option Strict.
What should I do in this case?
--
Betty

Feb 14 '06 #2
Hi GS,
I did
ctrlarr = CType(Session(" ctrlarr"), PeopleInfo())
It didn't complain anything.
I haven't run the code, guess it's OK.
Thank you.

--
Betty
"GS" wrote:
You have to cast to specific type before assiging it back.
In c# it will be ctrlarr = (subway.peoplei nfo)Session("ct rlarr")
Not sure what VB cast looks like
"c676228" <be****@communi ty.nospam> wrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi all,
I have the following code, without option Strict on, it seems work OK,
but
when option strict is on. I have a problem for the assignment.

Dim ctrlarr(5) As PeopleInfo 'poepleinfo is user control in project
Dim i As Integer
If Not Session("ctrlar r") Is Nothing Then
ctrlarr = Session("ctrlar r")
End If
It says option strict on disallows implicit conversion from
'system.object'
to '1-dimensional array of subway.peoplein fo'
I guess I would have the same problem when I assign
Session("ctrlar r")=ctrlarry in the first page if I turn on option Strict.
What should I do in this case?
--
Betty


Feb 15 '06 #3
Hi Betty,

I suggest always explicitly cast object to their actual type since that'll
also help improve performance and avoid problem.

If there're any other problem, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 15 '06 #4

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

Similar topics

14
3240
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
14
2264
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows at a page.I have a search criteria to search the records based on the data range i give This is what i have done, in the !IsPostBack section. I am setting up the oracle connection, creating dataset object, datadapter and i aslo load the data...
7
1655
by: Mike | last post by:
Hi, I am developing an application with framesets (header, left navigation, and content). Each frameset loads an ".aspx" page, and in one of these pages, I store some information in the Session object, as follows: .... Session = false; ....
2
2091
by: Diffident | last post by:
Hello All, I have a nested user control i.e., Control B which is loaded from Control A. Control A is itself dynamically loaded from a web form. Control A has a "Save" button which loads the Control B dynamically. Now in Control B there is a "Return" button which calls the method A of Control A. In method A, a session variable is being retrieved. My problem is whenever the control is passed back to the Control A, error is being thrown...
0
1178
by: Diffident | last post by:
Hi Steve, Please find the code snippets below: Method A inside User Control A: ------------------------------------------- public void LoadDataGrid() { DataSet ds = new DataSet();
13
2860
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or not.... what is this effect?
9
5316
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of copy paste (I hear this will improve in ASP.Net 2 via master pages). When I navigate from one page to the next the header and footer user controls lose their state because they are effectively different instances of the user control. Is there...
3
2679
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
2
1487
by: Gurunadh | last post by:
Hi i've some web user controls in one folder and web pages in some other folder. and i've included header web user control in all my web pages. and in that user control wrote code to get the logged in user details to be displayed in header. In login user control, the logged in userid was stored in a session.
0
9645
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
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
10147
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...
0
8971
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
7499
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
6739
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.