Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

error when executing SIVApp StartAppAndAutomate

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi

I am running in visual studio 2015 the following procedure:

Sub CrearProyecto1(ByVal Proyecto As String)

Dim iSolerr As Short
Dim iOSerr As Long
Dim screen As String
SIVApp = Nothing

screen = "PAPRJ00.exe"
Try
SIVApp = StartAppAndAutomate(screen.ToString(), iSolerr, iOSerr)
SIVApp.[New]("Project")
SIVApp.Controls("cproject").Value = Trim(Proyecto)
SIVApp.Controls("cmanager1").Value = "00"
SIVApp.Controls("cgl_subacct").Value = "00000"
SIVApp.Controls("cproject_desc").Value = "Expediente Nro " + Trim(Proyecto)
SIVApp.Controls("cpjt_entity").Value = "O"
SIVApp.Controls("cpjt_entity_desc").Value = "Actividad 1"
SIVApp.Save()

Catch ex As System.Runtime.InteropServices.COMException
Dim lErrNumber As Integer
If ex.Source.Contains("Solomon") = True Or ex.ErrorCode - vbObjectError > 0 Then

If ex.Source.Contains("Solomon") = True Or ex.ErrorCode - vbObjectError > 0 Then
lErrNumber = ex.ErrorCode - vbObjectError
Else
lErrNumber = ex.ErrorCode
End If
End If

Select Case lErrNumber
Case 2048 'non-fatal exception '(Message event has just fired before this)
iSolerr = Val(Err.Description)
Select Case iSolerr
Case 9 'Not found 'fix problem or give up

Case 15 'value was too small 'fix problem or give up

Case 23 'Wrong GL Period
MessageBox.Show("Error 23, Periodo en GL errado")


End Select

Case 7500 'Already logged in
Case 7501 'System Database Name > 20 Characters
Case 7502 'Wrong System Database Server Database Name
Case 7503 'Incorrect Company ID, User ID, or Password
Case 7504 'System Database Does Not Exist
Case 7505 'Interactive User ID <> Client Login
Case Else
MsgBox(ex.Message, MsgBoxStyle.Exclamation, String.Format("{0} Error {1}", ex.Source, lErrNumber.ToString()))
End Select

Catch ex As Exception
'do work
'MsgBox(ex.Message, MsgBoxStyle.Exclamation, String.Format("{0} Exception", ex.Source))

Finally
Dim lErrNumber As Integer
'SIVApp.Visible = "True"
'MessageBox.Show("Now Quiting application screen " + screen.ToString())
Try
SIVApp.Cancel()
SIVApp.Quit()
SIVApp.Dispose()
Catch ex As Exception

MsgBox(ex.Message, MsgBoxStyle.Exclamation, String.Format("{0} Error {1}", ex.Source, lErrNumber.ToString()))

Finally
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()

'MessageBox.Show("Done with Automation of screen " + screen.ToString())
End Try

End Try
End Sub

but when executing it shows me the following error: Object reference not established as an instance of an object

this routine works in visual studio 2008 and in sl 7.x, but in visual studio 2015 in sl 2018.x no

regards
 

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans