我希望从该项目的其他DLL和EXE中看到位于某个DLL中的全局变量。
我在VB文件中包含了“Option Explicit On”作为第一行。
但仍然没有人能看到我在该文件中定义的变量。 我认为该项目的所有DLL都依赖于那个带有定义的DLL,但没有任何帮助。
我正在使用模块,所有变量都是公开的。
Option Explicit On
Module LPSoft_Core
#Region "Public"
Public FormHdrText As String = "PC"
Public PCBLWebHomeAddr As String = "http://"
Public PCBMSupportAddr As String = "https://emea"
Public PgmDir As String
Public GridSp As Double = 5 'mm'
Public str_GAAlpha(20) As String
Public pLoc As Point
Public Convu2mm As Single = 0.001 'convert microns to mm'
Public Convmm2u As Integer = 1000 '1 / ConvFactor_u2mm 'convert mm to microns''
Public Convmm2Inch As Double = 1 / 25.4
Public Convmm2Mil As Double = 1 / 0.0254
Public LogFile As Integer
Public strLog As String 'holds log info when logfile can't be written
#End Region
#Region "Enums"
Public Enum eCompOrient
IPC = 0
IEC = 1
VPL = 2
End Enum
Public Enum eHdrGrp
None = 0
Alpha = 1
OneRowOneCol = 2
OneRowMultiCol = 3
OneColMultiRow = 4
TwoRowTwoCol = 5
TwoRowMultiCol = 6
TwoColMultiRow = 7
MultiRowMultiCol = 8
End Enum
Public Enum PinNumber
RowAlpha
ColAlpha
Numeric = 0
Alpha = 1
End Enum
有什么想法吗?
答案 0 :(得分:4)
根据this MSDN page,默认情况下,模块为Friend
。为了能够从不同的项目访问它,您需要将其声明为Public
,如下所示:
Public Module LPSoft_Core
...
End Module