Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21251

function isnt starting

$
0
0
Hi,

I ve a little Problem.

I wrote a function who should save and load settings.

The function itself is working but it isnt called.(I m speaking of the highlighted part.)

The Msg Box is shown("Test-Automation canceld") but the settings arent saved.

The file remains empty. If i wrote the same code at the beginning of the doc its working fine.

I hope u can help me.

best Regards

Sascha


Code:

' ************************************************************
' This is module *Module1 .
' Automatically generated uses comments are placed here.
' Don't edit these lines.
' {BEGINUSES}
'#Uses "*Module1"
'#Uses "*Module2"
'#Uses "*Module3"
'#Uses "*Module4"
'#Uses "*Module5"
' {ENDUSES}
' ************************************************************

'-->necessary links: Microsoft Xml v6 ; Microsoft Comm Control 6.0 (anscheinend doch nicht :-D)

Public Cancel As Boolean


Public Sub OnCmdTestWizard()

        '--> Cancel Button pressed

        Cancel = False

        Dim Path As String
        Dim ModuleDisabled(1) As Boolean 'ModulDisabled(0) --> PTOC
        Dim OCC As String
        Dim ii As Integer


        OCC = "OMICRON Control Center"


        Settings = SaveLoadSettings(False,"","")

        MsgBox(settings(1))



        'Continue Canceled Automation

        If Settings(0) <> Empty Then

                RestartAutomation = MsgBox("Do You like to continue the Canceled Automation [Yes] or Start anew [No].",vbYesNo,OCC)

                If RestartAutomation = vbNo Then

                        'maybe deleting the existing Test-Modules

                        ii=0

                        HardwareConfigured = MsgBox("Please configure the Hardware before you start." &"If you did this already Press [OK] otherwise [Cancel]!",vbOkCancel,OCC)

                Else

                        Path = Settings(0)

                End If

        Else

                HardwareConfigured = MsgBox("Please configure the Hardware before you start." &"If you did this already Press [OK] otherwise [Cancel]!",vbOkCancel,OCC)

                ii=0

        End If






        If HardwareConfigured = vbOK Or RestartAutomation = vbYes Then

                        Path = Browse

                If Path <> Empty Then

                        XMl = xXML(Path)

                        If XML(0).ModuleName <> "End" Then

                                For i=ii To 1 'need to be changed back to 200

                                        tModule=XML(i)

                                        If tModule.ModuleName = "PTOC" Then

                                                If tModule.Modus="On" Then

                                                        Deviations = DevSettings("PTOC",tModule.Threshold,tModule.Delay)'Deviations(i) = 0)neg threshold 1)pos threshold 2)neg delay deviation 3)pos delay deviation

                                                        If Cancel = True Then

                                                                SaveLoadSettings(True,"bla","bla")

                                                                MsgBox("Test-Automation canceled.",vbInformation,OCC)

                                                                Exit For

                                                        Else

                                                                Ramping("PTOC",tModule.Threshold,tModule.Delay,tModule.FallbackRatio,Deviations,Path)

                                                        '        StateSequencer("PTOC",tModule.Threshold,tModule.Delay,tModule.FallbackRatio,Deviations,Path)

                                                        End If

                                                ElseIf tModule.Modus ="Off" Then

                                                        ModuleDisabled(0) = True

                                                End If

                                        ElseIf tModule.ModuleName = "End" Then

                                                If ModuleDisabled(0) = True Then

                                                        MsgBox("Some of the PTOC-Modules are disabled in the Relais-Settings",vbExclamation,OCC)

                                                End If

                                                MsgBox("Test Automation abgeschlossen.",vbExclamation,OCC)

                                                Exit For

                                        End If

                                Next

                                ii=0

                        End If

                End If

        Else

                MsgBox("Test-Automation canceled.",vbInformation,OCC)

        End If

        SaveLoadSettings(True,"","")

End Sub



EDIT: Ahh, damn I just found the mistake myself, just in the Moment i posted this..:D...The function is called twice and the SaveLoadSettings at the end is overwriting the settings..:D..

Viewing all articles
Browse latest Browse all 21251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>