Create your own VB file, called it Globals.vb or Utility.Vb or something:
Public Class Globals
Private Const _smtpServer As String = "127.0.0.1"
Public ReadOnly Property SmtpServer() As String
Get
Return _smtpServer
End Get
End Property
...
End Class
You can then access this as Globals.SmtpServer
If this is a serious project, consider implementing a configSection which
won't hard-code a value into your .dll:
http://openmymind.net/Configuration/index.html
Karl
"2obvious" <vadivasbro@hotmail.com> wrote in message
news:6e537be.0409031549.364cbdaf@posting.google.co m...[color=blue]
> I want to declare some constants on the application level in
> global.asax to use throughout my application, e.g.:
>
> Sub Application_OnStart()
> Const NUM As Integer = 5
> End Sub
>
> Problem is, when I do it this way, the scope of the constants is
> local--attempting to use these constants in a typical .aspx file
> throws an error telling me that 'NUM' is undeclared. Doing this:
>
> Sub Application_OnStart()
> Global Const NUM As Integer = 5
> End Sub
>
> or this:
>
> Sub Application_OnStart()
> Public Const NUM As Integer = 5
> End Sub
>
> doesn't work either; illegal syntax.
>
> Can this be done? Keep in mind I'm talking about global _constants;_
> I already know how to make Application variables. Those are
> variables, they can be changed.[/color]