PFS: Fehler beim Anlegen einer Pause

PFS: Fehler beim Anlegen einer Pause

Hallo!
Ich versuche gerade per C# den PFS zu parametrieren.
Beim Anlegen einer Pause wird das Script bei ".CreateBreak" einfach ohne Fehlermeldung abgebrochen.
Auszug aus dem Code:
C# Code:

...
try
{
lsPausenname[0] = "Morgen";
zoModellBreak = zoModellShift.Breaks().CreateBreak(lsPausenname);
zoModellBreak.StartTime = Convert.ToDateTime("08:30:00");
zoModellBreak.EndTime = Convert.ToDateTime("08:45:00");
}
catch(Exception e)
{
System.Diagnostics.Debug.Print(e.Message);
}
...

Alle Objects sind definiert und gesetzt, mehrfach kontrolliert.
in der Exception habe ich folgendes gefunden:
[INDENT]
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Step into: Stepping over non-user code 'System.Exception.Message.get'
Typkonflikt. (Ausnahme von HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))[/INDENT]
Keine Ahnung wo das Problem liegen könnte.
Was mich auch wundert ist die Definition der CreateBreak-Methode. Warum wird hier ein Array erwartet? Ist soweit ich gesehen habe die einzige Create-Methode für den PFS die so erwartet wird.
Im VBA Beispiel der Hilfe sieht es anders aus:
VBA Code:
''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''Creating some breaks'''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''
Sub holidaytest()

Dim mypfs As PfsEngine
Set mypfs = MyWorkspace.ActiveDocument.PFS
Dim mystring As String
Dim i As Double

For i = 0 To 5

mystring = "testbreak" & i

mypfs.Groups.Item(0).TimeModells.Item(0).Shifts.Item(0).Breaks.CreateBreak (mystring)
Debug.Print mystring & " was created!"

Next i

End Sub

Für einen Tipp wäre ich sehr dankbar!
Gruß,
H.-P.

This is a migrated post! Originally posted on 28.10.2013 by user hp. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com