If you declare a DLL import with the SetLastError attribute then you can get the equivalent of VB classic's :
VB Code:
  1. Err.LastDllError
with
VB Code:
  1. System.Runtime.InteropServices.Marshal.GetLastWin32Error
..and like in VB classic you need to call the FormatMessage API call to get a description from this error:

VB Code:
  1. Public Enum Format_Message_Flags
  2.         FORMAT_MESSAGE_ALLOCATE_BUFFER = &H100
  3.         FORMAT_MESSAGE_IGNORE_INSERTS = &H200
  4.         FORMAT_MESSAGE_FROM_STRING = &H400
  5.         FORMAT_MESSAGE_FROM_HMODULE = &H800
  6.         FORMAT_MESSAGE_FROM_SYSTEM = &H1000
  7.         FORMAT_MESSAGE_ARGUMENT_ARRAY = &H2000
  8.     End Enum
  9.  
  10.     Private Const MAX_MESSAGE_LENGTH = 512
  11.  
  12.     <DllImport("kernel32.dll", EntryPoint:="FormatMessageA", _
  13.      CharSet:=CharSet.Ansi, _
  14.      ExactSpelling:=True, _
  15.      CallingConvention:=CallingConvention.StdCall)> _
  16.     Private Function FormatMessage(ByVal dwFlags As Format_Message_Flags, ByVal lpSource As Int32, ByVal dwMessageId As Int32, ByVal dwLanguageId As Int32, ByVal lpBuffer As String, ByVal nSize As Int32, ByVal Arguments As Int32) As Int32
  17.  
  18.     End Function
  19.  
  20.    Public Function GetAPIErrorMessageDescription(ByVal ApiErrNumber As Int32) As String
  21.  
  22.         Dim sError As New StringBuilder(MAX_MESSAGE_LENGTH)
  23.         Dim lErrorMessageLength As Int32
  24.  
  25.         lErrorMessageLength = FormatMessage(Format_Message_Flags.FORMAT_MESSAGE_FROM_SYSTEM, 0, ApiErrNumber, 0, sError, sError.Capacity, &H0)
  26.         If lErrorMessageLength > 0 Then
  27.             GetAPIErrorMessageDescription = sError.ToString
  28.         End If
  29.  
  30.  
  31.     End Function

Hope this helps,
Duncan