Last post Mar 01, 2012 06:04 AM by venkatmca008
Mar 01, 2012 05:39 AM|Smadhu|LINK
how to declare global variable in page in vb.net
Dim Counter As integer
Mar 01, 2012 05:42 AM|urenjoy|LINK
Application objects, if you need such a "global".
Use Session if needed per user,Application if for the whole application.
Mar 01, 2012 05:42 AM|salman behera|LINK
Global variables in .net 2.0 dont really exist the way they used to in C++ for example, because you dont have a single instance class running. If you are in the ASP.NET model, you can use the global.asax file to declare a Public or Public Shared variable,
or you can use Sessions as your global variable holder.
If you are in a VB model for win forms, Your best bet is to declare a class, and put a public member in it that will hold your value, and instanciate it when the application starts.
Mar 01, 2012 05:43 AM|rohitpundlik|LINK
In VB.NET we have module to declare global variable, which can be accessed across all the forms
Public moduleinteger As Integer
Mar 01, 2012 05:48 AM|Smadhu|LINK
i want to delcare only 1 varaible on 1 page as global
can u please help me wid the code
Mar 01, 2012 05:55 AM|rohitpundlik|LINK
you can declare it as a Static variable and use it...
Mar 01, 2012 06:00 AM|Smadhu|LINK
i have to declare varaible in backend code and has to use in front end code
public Counter as integer
will this work as global
Mar 01, 2012 06:04 AM|venkatmca008|LINK
hi...u can put this and use it any whare in apps
Application["varname"] = "sample!"
or craete a simple class like this
Public Class Sample1
Public Shared varname As String = "hi "
then call Sample1.varname
create class ---
Public NotInheritable Class [Global]
Private Sub New()
Shared _importantData As String
Public Shared Property ImportantData() As String
_importantData = value
u can set and we can get adata also