Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
ColdWatermelonJuice
914 Views, 7 Replies

Is it possible to use "AddVBFile" in Straight VB Code File?

Hi all,

 

I am trying to call a sub, which is declared in a class from a separate VB file, and this sub also calls another sub from a module declared in another separate VB file. 

 

To summarise, I have a total of three VB files, and all of them are stored under the iLogic external rule directory.

 

The code is shown below.

 

File: Code.vb

AddVbFile "ExternalClass.vb"

Sub Main()

    ClassA.MSGC()

End Sub

 

File: ExternalClass.vb

AddVbFile "ExternalModule.VB"

Public Class ClassA

    Public Shared Sub MSGC()
        System.Windows.Forms.MessageBox.Show("Call from ClassA")
        ModuleB.MSGM()
    End Sub

End Class

 

File: ExternalModule.vb

Public Module ModuleB

    Public Sub MSGM()
        System.Windows.Forms.MessageBox.Show("Call from ModuleB")
    End Sub

End Module

 

After I ran the Code.vb file. I got the following error message.

Rule Compile Errors in Code, in Part1

Error on Line 1 : Declaration expected.
Error on Line 7 : 'ModuleB' is not declared. It may be inaccessible due to its protection level.

 

I think Line 1 and Line 7 refer to lines in ExternalClass.vb.

My induction is that straight vb code does not support AddVBFile as it's for ilogic only.

My programming knowledge is very limited, and I do not know how to set up a code that is equivalent to AddVBFile.

 

Much appreciated for your help.

Labels (2)