Print Page | Close Window

nullreferenceexception- dockingpanel help...

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=16179
Printed Date: 16 May 2024 at 11:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: nullreferenceexception- dockingpanel help...
Posted By: Jack.Lau
Subject: nullreferenceexception- dockingpanel help...
Date Posted: 11 February 2010 at 10:42pm
dear all:
      i meet an an err: System.NullReferenceException:Objec reference not set to an instance of an object when
show a child form with dockingpanel and commandbar control in a mdi form.
 
     step1: create a mdi form "MDIParent1" with menu item "new form"
     step2: create another form "Form1"
     step3: put a dockingpanel and commandbar  control in form1, put another two RichTextBoxs as panels
     step4: code in form1 is follows:
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Control, CtlProject As XtremeCommandBars.CommandBarControl
        CtlProject = wndAxCommandBars.ActiveMenuBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlPopup, 100, "New", -1, False)
        With CtlProject.CommandBar.Controls
            Control = .Add(XtremeCommandBars.XTPControlType.xtpControlButton, 200, "Exit")
            Control.BeginGroup = True
            Control = .Add(XtremeCommandBars.XTPControlType.xtpControlButton, 300, "Login")
            Control.BeginGroup = True
        End With
        wndAxDockingPane.SetCommandBars(wndAxCommandBars.GetDispatch)
        wndAxDockingPane.Options.HideClient = True
        Dim panA, panB As XtremeDockingPane.Pane
        panA = wndAxDockingPane.CreatePane(1, 220, 1200, XtremeDockingPane.DockingDirection.DockLeftOf, Nothing) '
        panA.title = "This pane1"
        panB = wndAxDockingPane.CreatePane(2, 220, 1200, XtremeDockingPane.DockingDirection.DockBottomOf, panA) '
        panB.title = "This pane1"
    End Sub
    Private Sub wndAxDockingPane_AttachPaneEvent(ByVal sender As System.Object, ByVal e As AxXtremeDockingPane._DDockingPaneEvents_AttachPaneEvent) Handles wndAxDockingPane.AttachPaneEvent
        Select Case e.item.Id
            Case 1 : e.item.Handle = RichTextBox1.Handle.ToInt32
            Case 2 : e.item.Handle = RichTextBox2.Handle.ToInt32
        End Select
    End Sub
End Class
      step5: code in MDIParent1 is follows:
Imports System.Windows.Forms
Public Class MDIParent1
    Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click, NewToolStripButton.Click
        Dim ChildForm As New Form1
        ChildForm.MdiParent = Me
        Static Dim m_ChildFormNumber As Integer
        m_ChildFormNumber += 1
        ChildForm.Text = "Doc - " & m_ChildFormNumber
        ChildForm.Show()
    End Sub
End Class
      step5: when startwith form1, every thing runs well, includes the commandbar and dockingpanel control
      step6: when start with MDIParent1 , it shows the form1 as a child form, when use the commandbar and dockingpanel control,
error occurs:
  err1: with commandbar
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Control, CtlProject As XtremeCommandBars.CommandBarControl
        CtlProject = wndAxCommandBars.ActiveMenuBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlPopup, 100, "New", -1, False)
----->System.NullReferenceException:Objec reference not set to an instance of an object
 
  err2: with dockingpanel
        Dim Control, CtlProject As XtremeCommandBars.CommandBarControl
        'CtlProject = wndAxCommandBars.ActiveMenuBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlPopup, 100, "New", -1, False)
        'With CtlProject.CommandBar.Controls
        '    Control = .Add(XtremeCommandBars.XTPControlType.xtpControlButton, 200, "Exit")
        '    Control.BeginGroup = True
        '    Control = .Add(XtremeCommandBars.XTPControlType.xtpControlButton, 300, "Login")
        '    Control.BeginGroup = True
        'End With
        wndAxDockingPane.SetCommandBars(wndAxCommandBars.GetDispatch)
        wndAxDockingPane.Options.HideClient = True
        Dim panA, panB As XtremeDockingPane.Pane
        panA = wndAxDockingPane.CreatePane(1, 220, 1200, XtremeDockingPane.DockingDirection.DockLeftOf, Nothing) '
        panA.title = "This pane1"----->System.NullReferenceException:Objec reference not set to an instance of an object
-------------------------------------

Visual Studio 2005 8.0.50727.42

Visual Basic Project

.net framework 2.0.50727

Codejock13.2.1 ActiveX




Replies:
Posted By: nvierros
Date Posted: 19 April 2010 at 5:59am
panA.title = "This pane1"----->System.NullReferenceException:Objec reference not set to an instance of an object

Hi,
I also have this error, is there a resolution?
Cheers



Posted By: modwyer8
Date Posted: 03 June 2010 at 12:39pm
I am having the same problem.  It seems that I get the NullReferenceException error when I set the MDIParent of the form that contains the DockingPanes.  If I remove that line then the form launches fine.

Now the question is, can the docking panes NOT be used on a child form in an MDI app?

-------------
Product: Xtreme SuitePro ActiveX 2009 (13.0.0)
Platform: Windows XP (32bit) - SP 3
Language: C#, VS2005



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net