I asked a question a while back that came up with the following solution of testing if I am running in the IDE. My solution was the following code. The variable IS_IN_IDE is declared Public in a module. The method SetServerValues is executed from the startup method in the application (Sub Main()) before any forms are loaded. In the Load event of the MDI parent I have the code frmHREmployeeInformation.l
blTest.Vis
ible = IS_IN_IDE. This is the ONLY place I set the visible property of this label. The label has the caption, "Running in IDE with Test Database"
The problem is that the label is being displayed on certain user's systems when running the compiled application. Can anyone give me a clue as to why this is happening? I have also determined that only the display of the label is being affected. In other words, in the If statement within SetServerValues() below, I set up variables to either point database access to test or production databases. If the compiled code is being run, I use production databases, even though the label is displayed that indicates I am in a test environment. There is NO POSSIBLE WAY the user could be running uncompiled code. They do not have VB installed on their machine.
==========================
==========
======
Public Sub SetServerValues()
If IsInIDE Then
...
IS_IN_IDE = True
Else
...
IS_IN_IDE = False
End If
End Sub
Private Function IsInIDE() As Boolean
Dim X As Long
X = 0
Debug.Assert Not TestIDE(X)
IsInIDE = (X = 1)
End Function
Private Function TestIDE(X As Long) As Boolean
X = 1
End Function
==========================
==========
==========
Start Free Trial