VB.Net error Cannot refer to an instance member of a class from within a shared method...
Posted on 2016-09-07
I'm trying to convert a Windows Form VB.Net app to a console application. What I have done is create a new public class, banged all the subroutines I had in the 2 forms I had in the original app in that new class as Public Sub, and rewrote the form Load event routines into normal subs, also placed in the new class. I replaced/got rid of any reference to form controls, and used console.writeline for any output. Then I changed the app type to console, and got rid of the now empty forms.
I then added a Shared Main subroutine in the new class to start the app.
I still have juts 3 errors remaining, of the type in the title, each on a call to one of the manuy Subs in the class, and I can't understand why, because my Main sub is calling a number of Public Subs, but I get the error only on 3 of them, and these Subs look to me to be exactly like all the other Subs that are called, so why would these 3 calls generate an error, and not all the other calls I have ? 2 of the 3 are calls to a sub without parameters, 1 has a string parameter.
What am I missing ? Where should I look for finding out why the calls to these 3 subroutines cause a compile error ?
Thanks for help, hints, tips !