Shared method in VB.NET cannot handle this why?

vb.net, visual-studio-2005

Solution

I think the problem lies with the Subroutine DoStuff. If both your subs lie in the same class, you are trying to refer to DoStuff from within PopulateTextFields, which is a shared sub.

In order to achieve this, you need to declare DoStuff as Shared as well.

Problem

(I tried with this question but this code isolates the problem better.) I have this code: ``` Public Shared Sub PopulateTextFields(ByRef stuffList As List(Of Stuff)) Dim aStuff As New Stuff For Each aStuff In stuffList DoStuff(aStuff) Next End Sub Private Sub DoStuff(ByRef theStuff as Stuff) .... End Sub ``` I get the following error highlighting DoStuff(aStuff): Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class. Didn't I get an explicit instance of Stuff when I wrote the Dim statement? Don't understand what's wrong. Thanks in advance!

Original source