VB.Net Open Doc

I am new to vb.net and this is probably a simple problem that I am having but I am trying to open a solidworks document using a button click event on a userform.  I am able to open the document just fine in the module and I try transferring that code over to the userform to open a document and I get an error that says "NullReferenceException was unhandled by user code".  Tried a few different variations setting parts as new but still get the same error.  Not sure what’s wrong so any help would be appreciated.

Module:

UserForm Code

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst

Imports System

Public Class Form1

    Public swApp As SldWorks.SldWorks

    Const FilePath As String = "C:\Users\jamesg\desktop\Block.SLDPRT"

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim swDoc As ModelDoc2 = Nothing

        Dim swPart As New PartDoc

        Dim boolstatus As Boolean = False

        Dim longstatus As Integer = 0

        Dim longwarning As Integer = 0

        swPart = swApp.OpenDoc6(FilePath, 1, 0, "", longstatus, longwarning)

    End Sub

End Class

SolidworksApi macros