Automation error: The object invoked has disconnected from its clients when the exe to exectuted the VB6 for the second time

Dear all,

I had this really common automation error when I run an exe file created by Visual Basic 6 for the second time. Whenever I ran the program for the first time that it works really well. But the second time always fails. When I ran in debug mode in Visual Basic 6, sometimes it worked. I checked the code and found it would be discontinued in the next part - CommonDialog1.ShowSave.

ReDim SelectedVar (1 NumSeleVar)
ReDim SelectedVarTxt (1 NumSeleVar)
I have = 1
For j = 1 To NumVar_GasPlants
If chkOpt (j - 1). Value then
SelectedVar (i) = j
SelectedVarTxt (i) is chkOpt (j - 1). Legend
i = i + 1
End If
Next J

'Get the name of the export file.
If not g_RunOutputMacro then ' check-out
CommonDialog1.cancelError = True
CommonDialog1.InitDir = curCasePath
If IsMonteCarlo then
CommonDialog1.FileName = "HourlyData_GasPlants_" & cmbYear.Text & "_" & cmbMonteCarlo.Text & ".csv".
On the other
CommonDialog1.FileName = "HourlyData_GasPlants_" & cmbYear.Text & ".csv".
End If
CommonDialog1.Filter = ' (*.csv) | * .csv.
CommonDialog1.FilterIndex = 1
        CommonDialog1.ShowSave
SelectedOutputFile = CommonDialog1.FileName
On the other
SelectedOutputFile = g_Output_FileName
End If

I have been tormented by this problem for almost a month. Any suggestions or ideas would be very appreciated!

Thanks a lot guys!

Hello

This problem would be treated better in the MSDN Visual Basic forums. Expertise it can help you with this problem.

https://social.msdn.Microsoft.com/forums/vstudio/en-us/home?Forum=vbgeneral

Thank you

Stephanie Podder

Tags: Windows

Similar Questions

Maybe you are looking for