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

How do I pass aninstantiated class from webform to winform?

I want the ability to fill in the public properties of a given class in a
webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in
order to grab th right class. Can this be done or is there a better way to
do this?
Nov 18 '05 #1
4 1271
I don't really understand what you are trying to do, or how this has anything to do with winforms.

if you need to put a object into the session and then pull it out, this should do it

dim myObj as ClassA = new ClassA
Session("something") = myObj
...
Dim anotherObj as ClassA
anotherObj = CType(Session("something"), ClassA)

"acool" <no**@sendme.com> wrote in message news:OC**************@tk2msftngp13.phx.gbl...
I want the ability to fill in the public properties of a given class in a
webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in
order to grab th right class. Can this be done or is there a better way to
do this?

Nov 18 '05 #2
You can store an arbitrary class in a session variable, and then recover it
by casting it back into the class:
dim foo1,foo2 as foo
Session("foo") = foo1
..
..
foo2 = directcast(Session("foo"),foo)

"acool" <no**@sendme.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I want the ability to fill in the public properties of a given class in a
webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in
order to grab th right class. Can this be done or is there a better way to
do this?

Nov 18 '05 #3
I am putting it in a session in a webform and then in a another winform I am
trying to pull it out of session.

"Raterus" <ra*****@spam.org> wrote in message
news:ec***************@TK2MSFTNGP09.phx.gbl...
I don't really understand what you are trying to do, or how this has
anything to do with winforms.

if you need to put a object into the session and then pull it out, this
should do it

dim myObj as ClassA = new ClassA
Session("something") = myObj
...
Dim anotherObj as ClassA
anotherObj = CType(Session("something"), ClassA)

"acool" <no**@sendme.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I want the ability to fill in the public properties of a given class in a
webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in
order to grab th right class. Can this be done or is there a better way to
do this?

Nov 18 '05 #4
I dare say you will need to pass a serialised version of the object via http
to the windows application. You can call the web application from the
windows application by using the System.Net.HttpWebRequestRequest object..

I suggest you either pass the serialised object as an xml data island within
a html page and parse the page for the xml or change the response
mimetype/contenttype to xml and pass back the serialised object by itself.

I hope this is enough to get you started

Regards

Mark Travis
"acool" <no**@sendme.com> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
I am putting it in a session in a webform and then in a another winform I am trying to pull it out of session.

"Raterus" <ra*****@spam.org> wrote in message
news:ec***************@TK2MSFTNGP09.phx.gbl...
I don't really understand what you are trying to do, or how this has
anything to do with winforms.

if you need to put a object into the session and then pull it out, this
should do it

dim myObj as ClassA = new ClassA
Session("something") = myObj
..
Dim anotherObj as ClassA
anotherObj = CType(Session("something"), ClassA)

"acool" <no**@sendme.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I want the ability to fill in the public properties of a given class in a webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in order to grab th right class. Can this be done or is there a better way to do this?


Nov 18 '05 #5

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

Similar topics

0
by: Thom Little | last post by:
..NET Framework 1.1 I have a C# WinForm that invokes a C# WebForm using System.Diagnostics.Process.Start( ) to invoke the default browser and access a specific URL. This works great but I can...
6
by: Zingam | last post by:
Is it possible to insert a WinForm in a WebForm? I'd like for example to insert a managed directx viewer in a webform, that would display 3d graphics on the form? Is this possible? Regards,...
9
by: Peter Afonin | last post by:
Hello: I need to clear all textboxes on the webform after the data has been submitted. How can I do this in one step? I found a C# code: // get a reference to your form control Control frm...
2
by: Matt Theule | last post by:
I need to be able to allow users to drag files to a list box on a web page. To this end, I created a Windows Control and hosted it in a WebForm. When the file is dropped onto the listbox, the...
4
by: acool | last post by:
I want the ability to fill in the public properties of a given class in a webform pump that class into a session variable and then recreate a new instance of that class in order to grab those same...
7
by: Dean Slindee | last post by:
I would like to hear some practical comments about how to decide whether a new application becomes a Winform vs a Webform application. Would you say that every app should be, by default, a Winform...
13
by: andrea | last post by:
Sorry for the stupid question, I know, but sometimes is necessary starts from the basic. I don't know how to pass the result of a method generated from a DAL class to a BL class returning the...
3
by: Gordon | last post by:
Hi; Can you add a column of button controls to a winform datagrid ? I have a form with three independant grids. I would like to add buttons i.e. update, add buttons at the end of each row....
9
by: Victory | last post by:
Hi, Our group has to develop a new UI. We are using a third party and have them develop this since we don't have a lot of experience in doing this. We want it to be accessible through the web...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
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
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,...

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.