473,624 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to do this with Option Strict On?

Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #1
8 1173
just an idea why not passing as a Session Variable ?
--

Bruno Alexandre
Strøby, Danmark

"a Portuguese in Denmark"
"Chad Dokmanovich" <ch************ *@comcast.netwr ote in message
news:wZ******** *************** *******@comcast .com...
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents that)

http://www.velocityreviews.com/forum...ter-pages.html
Feb 7 '07 #2
An interface should solve your problem and happens to be the correct
approach to tackle such a problem. Without an interface, you're effectvely
tying default2 to default3 - why not detach it from a concrete class and tie
it to a much more flexible interface?

Since you are vague about what "X" is.....
in your app_code,

interface IXContainer
{
string X {get ;}
}

class default3 : Page, IXContainer
{
...
}
dim passedX as string = ctype(Context.H andler, IXcontainer).X
oopps..I wrote 1/2 of that in C#....anyways, you get the idea...I think it
should work the way you want it to.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Chad Dokmanovich" <ch************ *@comcast.netwr ote in message
news:wZ******** *************** *******@comcast .com...
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents that)

http://www.velocityreviews.com/forum...ter-pages.html
Feb 7 '07 #3

Peter's post about using query string or HttpContext.Cur rent.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 01:40:46 -0500, "Chad Dokmanovich"
<ch************ *@comcast.netwr ote:
>Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #4
Have you tried using the new PreviousPage property? e.g.,

protected void Page_Load(objec t sender, EventArgs e)

{

if (PreviousPage != null)

{

TextBox textBox = PreviousPage.Fi ndControl("Para meter")

as TextBox;

if (textBox != null)

{

string parameter = textBox.Text;

Parameter.Text = parameter;

}

}

}

--Peter

Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Chad Dokmanovich" wrote:
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #5
Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that returns
an object that contains all of the property values that are passed from the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nom ail.comwrote in message
news:bj******** *************** *********@4ax.c om...
>
Peter's post about using query string or HttpContext.Cur rent.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 01:40:46 -0500, "Chad Dokmanovich"
<ch************ *@comcast.netwr ote:
>>Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html


Feb 7 '07 #6

Web forms are not designed for passing strongly typed data to each
other and certainly are not meant for one web form to call properties
in another form. HTTP pages have two well defined ways of passing
data--query string and form variables.

If the data you're passing is more complex than a string, then create
a class to contain the data and put that class in the
HttpContext.Cur ent.Items collection when passing it, and then cast it
on the receiving page back to the typed class.

Using Session is horrible because the data is not inherintly session
related--you're just passing it from one page to another and dumping
it into the Session is overkill and dangerous).

My $0.02.

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 15:11:52 -0500, "Chad"
<ch************ **@unisys.comwr ote:
>Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that returns
an object that contains all of the property values that are passed from the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nom ail.comwrote in message
news:bj******* *************** **********@4ax. com...
>>
Peter's post about using query string or HttpContext.Cur rent.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam
Feb 7 '07 #7
Interesting!

The HttpContext suggestion sounds like it is just what I am looking for!

I dont like query strings because I dont want users to have an opportunity
to manipulate the data that is passed between the pages. I could encode it,
which is probably always a good idea, although at the moment I am writing
for a mobile device and am concerned about the query string limit for the
browser running on the mobile device.

For mobile forms, there are no hidden text fields, there is a
HiddenVariables collection, and while I can persist data there while posting
back to the same page, I've had no luch using this collection to pass data
across forms (no data found on the receicing side). Seems like it should be
straight fwd but It doesnt work for me and I can't find much on the subject.
Here's a blurb:

http://safari.oreilly.com/0735615322/IDATX2T

I'm excited about and will now try the HttpContext suggestion....t hx!
"Samuel R. Neff" <sa********@nom ail.comwrote in message
news:j8******** *************** *********@4ax.c om...
>
Web forms are not designed for passing strongly typed data to each
other and certainly are not meant for one web form to call properties
in another form. HTTP pages have two well defined ways of passing
data--query string and form variables.

If the data you're passing is more complex than a string, then create
a class to contain the data and put that class in the
HttpContext.Cur ent.Items collection when passing it, and then cast it
on the receiving page back to the typed class.

Using Session is horrible because the data is not inherintly session
related--you're just passing it from one page to another and dumping
it into the Session is overkill and dangerous).

My $0.02.

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 15:11:52 -0500, "Chad"
<ch************ **@unisys.comwr ote:
>>Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that
returns
an object that contains all of the property values that are passed from
the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nom ail.comwrote in message
news:bj****** *************** ***********@4ax .com...
>>>
Peter's post about using query string or HttpContext.Cur rent.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

Feb 8 '07 #8

Here is another option:

10/24/2005
Web Session Wrapper for storing and retrieving objects

http://sholliday.spaces.live.com/blog/
If you .Remove it on the second page, then you shouldn't tax the Session
object.


"Chad Dokmanovich" <ch************ *@comcast.netwr ote in message
news:wZ******** *************** *******@comcast .com...
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html
>


Feb 8 '07 #9

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

Similar topics

3
296
by: droope | last post by:
I have a routine that does a standard comparison that I pass two objects to Private Function ColumnEqual(ByVal A As Object, ByVal B As Object) As Boolea ' Compares two values to determine if they are equal. Also compares DBNULL.Value If A Is DBNull.Value And B Is DBNull.Value Then Return True ' Both are DBNull.Value If A Is DBNull.Value Or B Is DBNull.Value Then Return False ' Only one is DBNull.Value Return A = B ...
9
2132
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster? If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but I would once and for all like to know what the...
13
3247
by: Cor | last post by:
Hi Option Strict gurus, Because of the so much given advises here to use Option Strict I did try to use that. But it gives an error and I don't know how to resolve that. The message is that Option Strict disallowes late binding. So how to do it then? The statement is from an example somewhere on MSDN (And don't ask why I use the Ax version from SHDOC, that is just because it has more methods) \\\\\\\\\\\\\
12
2071
by: Doug Hill | last post by:
Please, Microsoft, update Option Explicit Option Strict barks at late binding. We love late binding. So Option Strict flags too many things. Option Explicit is misleading. It allows Dim LastName rather than forcing
5
2942
by: John | last post by:
Hi I am getting conversion errors in the below code on the lines highlighted in red. Would appreciate any tips on how to fix these errors. Thanks Regards
8
1823
by: Rich | last post by:
Hello, If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a record in a sql Server view) .... Dim entry As Domino.NotesViewEntry Dim obj As Object str1 = entry.ColumnValues(0)
8
3975
by: Clark Stevens | last post by:
I've always used Option Strict in my code. However, I was wondering if it is really necessary. Coding seems a lot easier when you don't use it, but does it really make a difference? What are the advantages of having Option Strict set to on? Are there situations were you could run into big problems leaving it off?
3
1601
by: Rich | last post by:
Hello, The following Delegates example works with Option Strict Off, but if I change it to Option Strict On then VB.Net complains about the line dgY = System.Delegate.Combine(dgI, dgA) Is there a way to use the Combine method of Delegates in VB.Net with Option Strict On?
30
1849
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster? If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but I would once and for all like to know what the...
17
4479
by: David | last post by:
Hi all, I have the following problem: my program works fine, but when I add option strict at the top of the form, the following sub fails with an error that option strict does not allow late binding. What should I do? Public Sub MyMnuHandler(ByVal sender As Object, ByVal e As System.EventArgs) If sender.checked = True Then sender.checked = False Else sender.checked = True
0
8231
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
8168
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
8672
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
8614
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
8471
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
7153
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
6107
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...
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1474
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.