Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

Global variable ASP.net VB.Net

Hi Experts,

I want to create a global variable and use it throughout the program.  I am using  "Public Action As String". But it does not work.
What should I do?

Thanks in advance.
Avatar of Serge Fournier
Serge Fournier
Flag of Canada image

You can define a class called "glovar" (or any other name)
Then you set some variables in it
Then you use the variables as global.variable01

My example is from an autocad addin in .net 4.0 if i remember well

Imports glovar


Public Class BatchPDF
            sub deletelogs'=== delete error log
            Dim Ecrire = objfso.OpenTextFile(glovar.file03, 2, True)
end sub
end class

Public Class glovar
    Public Shared file02 As String = "C:\_stas\224226_cad_2013_net40\zzz_cadbacth_addin_log.txt"
    Public Shared file03 = "C:\_stas\224226_cad_2013_net40\Batch PDF avec Autocad STAS.log"
End Class

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Tapan Pattanaik
Tapan Pattanaik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

ASKER

Thanks.