web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

error when executing SIVApp StartAppAndAutomate

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans