title: Reference to a non-shared member requires an object reference vb.net?
body: <p>How do I fix the following error: </p>
  
  <pre><code>   Error 1: "Reference to a non-shared member requires an object reference."
  </code></pre>
  
  <p>On Line: </p>
  
  <pre><code>   shortCut = CType(WshShell.CreateShortcut(creationDir &amp; "\" &amp; shortcutName &amp; 
     ".lnk"), IWshRuntimeLibrary.IWshShortcut) 
  </code></pre>
  
  <p>Here's my full code sample (if needed for context):</p>
  
  <pre><code>Imports IWshRuntimeLibrary
  Module MainModule
      Public Function CreateShortCut(ByVal shortcutName As String, ByVal creationDir As String, ByVal targetFullpath As String, ByVal workingDir As String, ByVal iconFile As String, ByVal iconNumber As Integer) As Boolean
          Try
              If Not IO.Directory.Exists(creationDir) Then
                  Dim retVal As DialogResult = MsgBox(creationdir &amp; " does not exist. Do you wish to create it?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo)
                  If retVal = DialogResult.Yes Then
                      IO.Directory.CreateDirectory(creationDir)
                  Else
                      Return False
                  End If
              End If
  
              Dim shortCut As IWshRuntimeLibrary.IWshShortcut
              shortCut = CType(WshShell.CreateShortcut(creationDir &amp; "\" &amp; shortcutName &amp; ".lnk"), IWshRuntimeLibrary.IWshShortcut)
              shortCut.TargetPath = targetFullpath
              shortCut.WindowStyle = 1
              shortCut.Description = shortcutName
              shortCut.WorkingDirectory = workingDir
              shortCut.IconLocation = iconFile &amp; ", " &amp; iconNumber
              shortCut.Save()
              Return True
          Catch ex As System.Exception
              Return False
          End Try
      End Function
  </code></pre>