sharing form data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

There are a lot of ways you can share values between web forms.
1. Use context object to store and retrieve values between forms. (ideal for
data transfer.)
2. Use querystrings. (can be used for in sensitive data transfer)
3. Use sessions (does have memory impact on server)
4. use hidden form fields (Should post the form)

Hope this helps
Ganesh
 
David,

Because that you got from Ganesh the information about webforms, can you
tell what your form is (webform or windowform). In a windowform it is in
whatever way passing the references (because windowforms are persistent),
this is (in the windowform way) impossible in a webform because that is not
persistent for a client.

You can make classes that have static (shared) members, however not really
the nicest way to make all the data completly from start to end in your
program persistent.

Cor
 
Hello,

Is it possible for you to :
- Put the controls in a new UserControl that you create
- Share the reference of this "MyOwnUserControl" across the two forms?
 
hmm i suppose. but i guess that also will violate .net guidelines, where
you're exposing values to the user like that.

You can have this UserControl implement an interface that the user
could be calling. But if a day you need to change the color, the font,
and all the other thousands of parameters then you have little choice
but to share the controls or create thousands of methods to do it.

Putting a UserControl means that :
- it is reusable
- it can be shared among several forms very easily
- you can add new controls onto in the future quite easily
- you can copy it to a new instance of itself
- etc

and only the guy who really want to access the internal controls of the
UserControl can without having the possibility to wrongly modify/access
the other controls of the form.
 
i'm trying to access the values of a set of controls on one form from
another form. how do i do this without breaking the .NET convention of not
declaring visible instance fields? do i have to make and assign properties
for each control?

cheers
dave
 
it is a windows form with basic controls, ie edit boxes, drop down list etc.
i appreciate any help, and please try and explain your answers as i'm not
that good a coder.

cheers
dave
 
hmm i suppose. but i guess that also will violate .net guidelines, where
you're exposing values to the user like that.
 
Back
Top