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

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("ctrlarr") Is Nothing Then
ctrlarr = Session("ctrlarr")
End If
It says option strict on disallows implicit conversion from 'system.object'
to '1-dimensional array of subway.peopleinfo'
I guess I would have the same problem when I assign
Session("ctrlarr")=ctrlarry in the first page if I turn on option Strict.
What should I do in this case?
--
Betty
Feb 14 '06 #1
3 1312
GS
You have to cast to specific type before assiging it back.
In c# it will be ctrlarr = (subway.peopleinfo)Session("ctrlarr")
Not sure what VB cast looks like
"c676228" <be****@community.nospam> wrote in message
news:88**********************************@microsof t.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("ctrlarr") Is Nothing Then
ctrlarr = Session("ctrlarr")
End If
It says option strict on disallows implicit conversion from
'system.object'
to '1-dimensional array of subway.peopleinfo'
I guess I would have the same problem when I assign
Session("ctrlarr")=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.peopleinfo)Session("ctrlarr")
Not sure what VB cast looks like
"c676228" <be****@community.nospam> wrote in message
news:88**********************************@microsof t.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("ctrlarr") Is Nothing Then
ctrlarr = Session("ctrlarr")
End If
It says option strict on disallows implicit conversion from
'system.object'
to '1-dimensional array of subway.peopleinfo'
I guess I would have the same problem when I assign
Session("ctrlarr")=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
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...
14
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...
7
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...
2
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...
0
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
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...
9
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...
3
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...
2
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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...

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.