Is there any way to use self Execute functions in vb6?

Asked

Viewed 30 times

0

In javascript we can write this in several ways:

(function () {
    console.log("Olá");
})();

(function () {
    console.log("Olá");
}());

! function () {
    console.log("Olá");
}();

void function () {
    console.log("Olá");
}();

I am working on a project in vb6, and I wanted to use something like a self-invoke function to not need to declare a function in the overall scope of my form, summarizing I want to call a function to which I will only use once within this function and will not use more.

Does anyone know if there is a way to do this without using gambiarra?

1 answer

1


Unfortunately no, VB6 only accepts Functions or Subs declared in the form scope. I worked with VB6 for some time and have never seen anything like it.

More information: https://www.vbtutor.net/lesson14.html

  • I found this not ideal, but it solved my problem https://www.thevbprogrammer.com/Ch05/05-05-GotoAndGosub.htm

Browser other questions tagged

You are not signed in. Login or sign up in order to post.