Announcement

Collapse
No announcement yet.

Problem mit .dll

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem mit .dll

    Ich weiß nich was da nicht funktioniert ! :/

    Dieser Code sollte eigentlich eine Form aus eine rKlassenbiblotek laden:
    [highlight=vbnet]
    Try
    Dim config As ConfigFile = console.LoadConfigfile(apppath)
    Dim app As Assembly = Assembly.LoadFile(apppath)
    app.CreateInstance(config.Type, True)
    Dim ai As IApplication = CType(app.CreateInstance(config.Type, True), IApplication)
    ai.app.MdiParent = Me
    ai.Start()
    Catch ex As Exception
    console.reporterror("BlackScreen", ErrorToString)
    End Try[/highlight]

    leider bekomme ich follgenden error:
    Das Formular kann nicht zugleich ein untergeordnetes MDI-Element und ein übergeordnetes MDI-Element sein.
    Parametername: value


    BITTE HILFE

  • #2
    Hallo,

    setzt du - ev. im Konstruktor des Formulares - die Eigenschaft, dass es ein MDI-Parent ist? Das geht aus der Fehlermeldung hervor. Geh mal mit dem Debugger durch und schau dir an, wo ev. diese Eigenschaft gesetzt wird.

    mfG Gü
    "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

    Comment


    • #3
      Ich versteh leider noch nicht so viel in VB. Was hat es mit dem MDI-Parent aufsich ?!

      Comment


      • #4
        Hallo,

        mit "config.Type" wird ein Formular angegeben, sonst macht der Code ja keinen Sinn. Öffne dieses Formular in VS mal mit dem Designer und schau dort die "MDI-Eigenschaften" an. Lt. Fehlermeldung ist es entweder dort als MDI-Parent gesetzt od. es wird irgendwo im Code gesetzt, aber nicht in dem von dir gezeigten, daher vermutete ich den Konstruktor der Form bzw. die dortige Initialize-Methode.

        Versuchsweise kannst du auch "ai.app.MdiParent = Me" weglassen und schauen was passiert.

        mfG Gü
        "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

        Comment


        • #5
          Ich hab jetzt mal die Line "ai.app.MdiParent = Me" ausgeblendet. Jetzt kommt zwar keine Fehlermeldung mehr aber es erscheint in meiner Application auch kein Fenster ?!

          Im Designer unter eigenschaften steht IsMdiContainer = True ?

          Hier nocheinmal der Vollständige Code meines Formulars das ich öffnen möchte :

          [highlight=vbnet]Imports BlackBox

          Public Class app
          Inherits BaseForm
          Implements IApplication


          Public Property app As BaseForm Implements IApplication.app
          Get
          Return Me
          End Get
          Set(value As BaseForm)

          End Set
          End Property

          Public Sub Start() Implements IApplication.Start
          RichTextBox1.Show()
          Panel2.Hide()
          Me.Height = 410
          End Sub

          Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

          End Sub

          Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
          RichTextBox1.Hide()
          Timer1.Start()
          Timer2.Start()
          While Timer1.Enabled = True Or Timer2.Enabled = True
          End While
          updateX()
          End Sub

          Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
          Me.Height = Me.Height - 5
          If Me.Height = 200 Then
          Panel2.Show()
          Timer1.Stop()
          End If
          End Sub

          Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
          Button1.Width = Button1.Width + 25
          If Button1.Width = 550 Then
          Timer2.Stop()
          End If
          End Sub

          Private Sub updateX()

          End Sub

          Private Sub app_Load(sender As Object, e As EventArgs) Handles MyBase.Load

          End Sub
          End Class[/highlight]

          Comment


          • #6
            Hallo,

            setzte mal IsMdiContainer = False.

            mfG Gü
            "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

            Comment


            • #7
              gesagt getan , wenn die Zeile "IsMdiContainer = True" ausgeblendet wird gibt es kein unterschied zu vorher, es passiert einfach garnix.

              Wenn die Zeile jedoch eingeblendet ist bekomme ich diesen Fehler: Das Formular, das als MdiParent für dieses Formular angegeben wurde, ist kein MdiContainer.

              Comment


              • #8
                Hallo,

                nach der neuen Fehlermeldung schaut es so aus, als ob das Formular, das mit "Me" referenziert wird, also jenes indem der Code aus dem ersten Post ausgeführt wird, nicht auf "IsMdiContainer = True" gesetzt wurde. Setzte dort die Eigenschaft auf True.

                mfG Gü
                "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

                Comment

                Working...
                X