I'm getting the following error
Object Reference not set to an instance of an object
On this line of code
VB Code:
  1. Private Declare Function ImageDirectoryEntryToData Lib "dbghelp.dll" (ByVal pBase As Long, ByVal bMappedAsImage As Long, ByVal DirectoryEntry As Int32, ByRef Size As Long) As Long
  2.  
  3. Private Structure IMAGE_EXPORT_DIRECTORY
  4.         Public Characteristics As Long
  5.         Public TimeDateStamp As Long
  6.         Public MajorVersion As Int32
  7.         Public MinorVersion As Int32
  8.         Public lpName As Long
  9.         Public Base As Long
  10.         Public NumberOfFunctions As Long
  11.         Public NumberOfNames As Long
  12.         Public lpAddressOfFunctions As Long
  13.         Public lpAddressOfNames As Long
  14.         Public lpAddressOfNameOrdinals As Long
  15.     End Structure
  16.  
  17. Const IMAGE_DIRECTORY_ENTRY_EXPORT = 0
  18. Private lngBaseAddress As Long
  19.  
  20. Dim pExportDirectory As Long
  21. Dim lngSize As Long
  22.  
  23. pExportDirectory = ImageDirectoryEntryToData(lngBaseAddress, 1, IMAGE_DIRECTORY_ENTRY_EXPORT, lngSize)[color=red]<----- This line[/color]
I am creating an application that allows the user to load a .dll file via the OpenFileDialog control. Then they click a button to enumerate the Functions in that dll.

Any ideas why I would be getting this error??? I created this application just fine in VB6 and have made all the necessary modifications to rewrite it in VB.NET, but am getting this error for some reason???