README.md

December 4, 2022 ยท View on GitHub

Possible error in VB6 Compiler

Description

This is possebly an error in the VB6 compiler but i have turned it into a way to find out if you are in the IDE or Compiled version.

More Info

Submitted On
ByMarco v/d Berg
LevelBeginner
User Rating4.9 (39 globes from 8 users)
CompatibilityVB 6.0
CategoryVB function enhancement
WorldVisual Basic
Archive File

Source Code

Just simple arithmatic can give different values in IDE-mode ore EXE-mode.
Insert this piece of code into a module and call the function IsIde.
it will return true if the programm is running in IDE-mode and false if running in EXE-mode (Compiled).
Take a look at the code and find out if this is an error or not.

Option Explicit
Private Test As Long
Public Function IsIde() As Boolean
 Test = 4
 Test = (Test + 1 + GetVal)
 If Test = 9 Then IsIde = True
'Test will give 9 if IDE and 10 if EXE
'This can be done with any initial value but ofcourse you get other results
End Function
Private Function GetVal() As Long
 GetVal = 4
 Test = Test + 1
End Function