This is part of a windows form application which prompts a user to "Please enter a sales order" and then will open up a CAD drawing. However, I'm getting an error at "dsDoc = dsApp.GetActiveDocument()". Can anyone help me out with this one? Thank you!
Private Sub startButton_Click(sender As Object, e As EventArgs) Handles startButton.Click
Dim salesOrder As Integer
If Int32.TryParse(txtboxSalesOrder.Text, salesOrder) Then
If salesOrder > 99999 AndAlso salesOrder <= 999999 Then
Using process As Process = New Process
Dim ProcessProperties As New ProcessStartInfo
ProcessProperties.FileName = "C:\Program Files\Dassault Systemes\DraftSight\bin\DraftSight.exe"
ProcessProperties.Arguments = ("C:\Users\MyUserName\Desktop\JE5022AA.dwg")
ProcessProperties.WindowStyle = ProcessWindowStyle.Hidden
process.Start(ProcessProperties)
End Using
Dim dsApp As DraftSight.Application
Dim application As Object
dsApp = Nothing
application = Nothing
Dim dsDoc As DraftSight.Document
dsDoc = dsApp.GetActiveDocument()
'An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication2.exe
'Additional information: Object reference not set to an instance of an object.
If dsDoc Is Nothing Then
Return
End If