MBHEY131
asked on
reference variable instances
here's my code:
sform variable opens and app starts fine however I would like to know the best way to access this variable instance of update some text boxes when I launch another form from the sform instance (I don't want to make in a GLOBAL VARIABLE or anything close to that)
I would like to know the best way to declare the FORM variable and keep it as narrow instance as possible.
I am trying to understand the FRIEND, PROTECTED FREIND, etc. access levels but would like some input as this is my first incursion to this coding area.
Public Class frmMain
Private Sub btnShopRO_Click(sender As Object, e As EventArgs) Handles btnShopRO.Click
Dim sform As New frmShopHandMain
sform.Show()
End Sub
End Class
there is other code there but I condensed it to the pertinent data.sform variable opens and app starts fine however I would like to know the best way to access this variable instance of update some text boxes when I launch another form from the sform instance (I don't want to make in a GLOBAL VARIABLE or anything close to that)
I would like to know the best way to declare the FORM variable and keep it as narrow instance as possible.
I am trying to understand the FRIEND, PROTECTED FREIND, etc. access levels but would like some input as this is my first incursion to this coding area.
ASKER
Local storage on the client side with a cookie,
++++++++++++++++++++++++++ ++++++++++ ++
that sounds like the best option in that I have been down the Global route before and learned some painful lessons
could you give me some instruction (very general would be fine) as I need to learn this -
or in this case as my project is going to be on a server - and thus many clients will be launching the app from the server - is staying away from GLOBAL a wise idea (as I don't even like that word)
any advice would be appreciated
++++++++++++++++++++++++++
that sounds like the best option in that I have been down the Global route before and learned some painful lessons
could you give me some instruction (very general would be fine) as I need to learn this -
or in this case as my project is going to be on a server - and thus many clients will be launching the app from the server - is staying away from GLOBAL a wise idea (as I don't even like that word)
any advice would be appreciated
ASKER
I have been looking into:
"Shared sform as frmshophandmain" declared in the form level would not serve my purpose I don't believe
"Shared sform as frmshophandmain" declared in the form level would not serve my purpose I don't believe
You need to make sure you've declared the include for HttpCookieCollection and have a look here about how to use Response.Cookie and Request.Cookie to access, create, and general usage of client side storage in ASP.NET:
How to work with Client-Side State Management in ASP.NET:
http://mrbool.com/how-to-work-with-client-side-state-management-in-asp-net/26364
ASP.NET State Management Recommendations:
https://msdn.microsoft.com/en-us/library/z1hkazw7%28v=vs.140%29.aspx
How to work with Client-Side State Management in ASP.NET:
http://mrbool.com/how-to-work-with-client-side-state-management-in-asp-net/26364
ASP.NET State Management Recommendations:
https://msdn.microsoft.com/en-us/library/z1hkazw7%28v=vs.140%29.aspx
Unless you're using another .NET technology, in which case client side storage is still an option.
Hi MBHEY131;
Visual Basic allows you to get a reference to a form by first getting a collection of FormCollection using the Application.OpenForms Property then you can find the form by name by using then FormCollection.Item Property (String) of the FormCollection.
Visual Basic allows you to get a reference to a form by first getting a collection of FormCollection using the Application.OpenForms Property then you can find the form by name by using then FormCollection.Item Property (String) of the FormCollection.
ASKER
Visual Basic allows you to get a reference to a form by first getting a collection of FormCollection using the Application.OpenForms Property then you can find the form by name by using then FormCollection.Item Property (String) of the FormCollection.
++++++++++++++++++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++++
Yes, I'm familiar with the above Property and use it to check for an open instance.
e.g. - "If Application.OpenForms().Of Type(Of frmShopHandMain).Count > 0 Then", etc
but how to I access the open instance by the variable "sform" and then reference the textboxes on the said form
without going GLOBAL
========================== ========== ========== ========== ========== ========== ========== ======
++++++++++++++++++++++++++
Yes, I'm familiar with the above Property and use it to check for an open instance.
e.g. - "If Application.OpenForms().Of
but how to I access the open instance by the variable "sform" and then reference the textboxes on the said form
without going GLOBAL
==========================
ASKER
Let me ask this:
Is it possible to DIM "sform" in a new block and set it equal to (my.application.openforms oftype(frmshophandmain))
or something similar.
Is it possible to DIM "sform" in a new block and set it equal to (my.application.openforms oftype(frmshophandmain))
or something similar.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect:
I will test FIRST thing in the AM
I will test FIRST thing in the AM
ASKER
That worked perfectly and solved all current issues
Thanx a bunch
Thanx a bunch
ASKER
thanx again
Not a problem MBHEY131, glad I was able to help.
Local storage on the client side with a cookie, session storage on the server side with a server side cookie, or throw it into a database field and access it again when you need.