I'm coming from Python to Visual Basic and it's really playing with my head. This program is intended to scan a list of directories (only have one directory so far) and see if they contain any files. If they do, their directory is added to a list (DirtyFolders) and all files in those folders will be deleted when a button is pressed.
When I try to add the folder's directory to the list it throws an exception, "Object reference not set to an instance of an object."
That might as well be Japanese as I have no clue what it is trying to tell me.
Public Class Engine Shared DirtyFolders As List(Of String) Public Shared Sub Scan() Dim folder = "C:\Tester" If HasFiles(folder) Then Show("Files found in " & folder) DirtyFolders.Add(folder) '<-- Error happens here Else Show("No files in " & folder) End If End Sub