Global Declares in VB .NET

  • Thread starter Thread starter Beebs
  • Start date Start date
B

Beebs

I need to put a conditional around some global, or public delclares in
my main module, but that obviously doesn't work. What other options
do I have to do this. My three variables are:

Dim MyReader As New Symbol.Barcode.Reader
Dim MyReaderData As New
Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text,
Symbol.Barcode.ReaderDataLengths.DefaultText)
Dim MyReaderHandler As New System.EventHandler(AddressOf
MyReader_Notify)

and they need to be accessible for the whole application if the device
is a certain type, which I'm able to check for in my Main()

Thanks
 
It means that you have not explained your scenario very well *and* you
assume all posts get replies within 13 hours.

What do you mean conditional? For compile time conditionals use #if

What do you mean "declares"? VB supports the Declare keyword but you can
also use DllImport.

For global access to variables make them Shared e.g.

Public Class MyGlobals
Public Shared MyReader As New Symbol.Barcode.Reader
End Class

Call it like this:
MyGlobals.MyReader.XXX

If you provide more info on your question we can help further...

Cheers
Daniel
 
Back
Top