DotNetSiemens Projekt laden

derwestermann

Level-2
Beiträge
628
Reaktionspunkte
65
Zuviel Werbung?
-> Hier kostenlos registrieren
Mooohoooin!

"Ich werd noch mal blöde mit dem Scheissdreck"
"wo kann man denn hier ma'................das man was sieht????"
"zweihundert Puls hab' ich.......................bald!"

Ich versuche gerade ein Projekt in VB.NET so zu öffnen, wie das im Beispiel von Jochen "ToolboxForSiemensPLCs" unter C#.NET auch gemacht wird.
Die Zeile in C#
Code:
Project tmp = Projects.LoadProject(fnm, chkShowDeleted.Checked);
Wird in VB.NET zu
Code:
Dim tmpProj As Project = Projects.LoadProject(fnm, chkShowDeleted.Checked)

Da kommt dann aber dies:

Code:
System.NullReferenceException wurde nicht behandelt.
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Source=Putz_ZM
  StackTrace:
       bei Putz_ZM.DB_Update.loadPrj(String fnm) in Z:\A\Putz_ZM\DB_Update.vb:Zeile 629.
       bei Putz_ZM.DB_Update.OeffneProjekt() in Z:\A\Putz_ZM\DB_Update.vb:Zeile 603.
       bei Putz_ZM.DB_Update.ButtonDBupd_Click_1(Object sender, EventArgs e) in Z:\A\Putz_ZM\DB_Update.vb:Zeile 572.
       bei System.Windows.Forms.Control.OnClick(EventArgs e)
       bei System.Windows.Forms.Button.OnClick(EventArgs e)
       bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       bei System.Windows.Forms.Control.WndProc(Message& m)
       bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
       bei System.Windows.Forms.Button.WndProc(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
        bei  System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr  dwComponentID, Int32 reason, Int32 pvLoopData)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.Run(Form mainForm)
       bei Putz_ZM.MainDesk.Main() in Z:\A\Putz_ZM\MainDesk.Designer.vb:Zeile 0.
       bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
        bei System.Threading.ExecutionContext.Run(ExecutionContext  executionContext, ContextCallback callback, Object state, Boolean  ignoreSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()
  InnerException:

In fnm steht aber der Dateiname mit Verzeichnis, "Z:\A\VB32703.S7\Vb32703.s7p", also weiß ich nicht, was da NULL sein soll.
Und wenn ich die Zeile zu
Code:
            Dim tmpProj As Project = New Project
             tmpProj = Projects.LoadProject(fnm, chkShowDeleted.Checked)
ändere, wegen dem New, dann meckert der Compiler, daß New nicht für eine Klasse verwendet werden darf, die als MustInherit deklariert ist.

In schierer Verzweiflung Euch um Rat anflehend

der Kai
 
Steht doch da:
bei Putz_ZM.DB_Update.loadPrj(String fnm) in Z:\A\Putz_ZM\DB_Update.vb:Zeile 629.

schau mal in zeile 629. mach da mal einen breakpoint....
 
Die Hinweise zur Fehlerbehandlung sagen:
Code:
Erstellen Sie eine Objektinstanz mit dem Schlüsselwort "new"
oder:
Code:
Überprüfen Sie , ob das Objekt NULL ist, bevor sie die Methode aufrufen
 
Zurück
Oben