nullreferenceexception- dockingpanel help... |
Post Reply |
Author | |
Jack.Lau
Groupie Joined: 13 January 2010 Status: Offline Points: 10 |
Post Options
Thanks(0)
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 Codejock |
|
nvierros
Groupie Joined: 02 July 2006 Location: Australia Status: Offline Points: 44 |
Post Options
Thanks(0)
|
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 |
|
modwyer8
Newbie Joined: 10 June 2009 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |