Reputation: 1328
I am suppose to make changes to one of the very old software that my co. sales. Its a VB5 project.
Just to be clear I CANT change language and must ABSOLUTLY use VB5.... (If I could change to C# I would be the happiest man on earth right now.)
Here is the problem.
I installed Microsoft Visual Basic IDE and loaded the .VBP file in.
I read the code to know what part does what but I would like to see it on screen step by step (Debug mode with breakpoints).
So, I punch in some breakpoints and hit "play" (debug button) but I got this error
Execution error '-2147024894 (80070002)': Automation Error
But curiously the soft work fine when I use the .exe I think it might be a problem with the debugger.
From here I have three options:
1-End program
It end the program
2-Debug
It send me to a line of code but I dont know what is the error.
Here is the code it point me on:
Private Sub Form_Load()
Dim strLangue As String
bBusy = False
Set gImgBackground = Me.imgBackground
Set gBackGround1 = LoadPicture(App.Path & "\images\bg1.gif")
Set gBackGround2 = LoadPicture(App.Path & "\images\bg2.gif")
Me.BackColor = &HC0E0E0
gIniPath = App.Path & "\posi1000.ini"
basMain.gLangFile = App.Path & "\" & inireadvalue(gIniPath, "general", "langfile", "")
If InStr(UCase(basMain.gLangFile), "FR") <> 0 Then
strLangue = "FR"
ElseIf InStr(UCase(basMain.gLangFile), "EN") <> 0 Then
strLangue = "EN"
Else
strLangue = "FR"
End If
strComType = UCase(inireadvalue(gIniPath, "general", "ComType", "MOELLER"))
If strComType = "MOELLER" Then
' Dim tJRT_COM As JRT_COM.TEST_MOELLER
' Set tJRT_COM = New JRT_COM.TEST_MOELLER
' Set tJRT_COM = New JRT_SUCOMA.JRT_SUCOMA
' Call tJRT_COM.openComDevice("COM1:19200", 0)
' Set Module1.MyJRT_COM = tJRT_COM
'' Dim t As String
'' Set tJRT_COM = JRT_COM.New(True)
' Set MyJRT_COM = CreateObject("JRT_SUCOMA.JRT_SUCOMA")
'MyJRT_COM = Ctype(
' Set MyJRT_COM = New JRT_SUCOMA.JRT_SUCOMA
'' Dim tJRT_COM As New JRT_SUCOMA.JRT_SUCOMA
'
'' Set tJRT_COM = Nothing
'
'' If Module1.MyJRT_COM.setComDevice(gComDevice, strLangue) = 0 Then
'' Module1.MyJRT_COM.
'' End If
'
ElseIf strComType = "OMRON" Then
' Set MyJRT_COM = New JRT_COM.JRT_OMRON
' Set MyJRT_COM = CreateObject("JRT_COM.TEST_OMRON")
' Set MyJRT_COM = MyJRT_COM_MOELLER
'' Else
'' Set MyJRT_COM = New JRT_COM.JRT_MOELLER
'' Set MyJRT_COM = CreateObject("JRT_COM.TEST_MOELLER")
End If
gOfflineMode = inireadvalue(gIniPath, "General", "OfflineMode", "0")
gComDevice = inireadvalue(gIniPath, "General", "ComDevice", "Com1:19200")
If inireadvalue(gIniPath, "General", "ShowSelectComDevice", "0") = "1" Then
If strComType = "MOELLER" Then
bBusy = True
If Module1.MyJRT_COM_MOELLER.SetComDevice(gComDevice, strLangue) = 0 Then
Call iniwritevalue(gIniPath, "General", "ComDevice", gComDevice)
End If
bBusy = False
ElseIf strComType = "OMRON" Then
bBusy = True
**********It point here**************************************************************
-> If Module1.MyJRT_COM_OMRON.SetComDevice(gComDevice, strLangue) = 0 Then
Call iniwritevalue(gIniPath, "General", "ComDevice", gComDevice)
End If
bBusy = False
End If
End If
End Sub
Just so you know I haven't write that code I am only doing some mod work.
Third option:
3-Help
It gives me another error
Cannot find the windows help.
What do I do??? Does anyone had that problem before ???
Upvotes: 2
Views: 208
Reputation: 1328
Got it! I had two dependencies "hard coded" in the vb project that would try to load two .dll on the wrong path even if I would browse Microsoft VB IDE to the right file. I had to place those file in the path specified by Microsoft VB5. And problem solve.
Upvotes: 3