Print Page | Close Window

Setting a handle on a User Form

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4864
Printed Date: 17 November 2024 at 6:02am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Setting a handle on a User Form
Posted By: PhilJeary
Subject: Setting a handle on a User Form
Date Posted: 23 August 2006 at 12:49pm
Hi all,
 
I had a form (frmMain) with the following:
 
Public A As Pane, B As Pane
 
Both are set up as follows:
Set A = DockingPaneManager.CreatePane(1, 250, 120, DockLeftOf, Nothing)
A.Handle = frmTreeViewPane.hWnd
Set B = DockingPaneManager.CreatePane(2, 800, 400, DockRightOf, A)
B.Handle = frmSelections.hWnd
frmTreeViewPane contains a shortcutbar with the following Forms that get displayed:
 
    Set ItemSelections = wndShortcutBar.AddItem(1, "Selections", frmSelectionsPane.hWnd)
    Set Item = wndShortcutBar.AddItem(2, "User Tables", frmUserTablesPane.hWnd)
    Set Item = wndShortcutBar.AddItem(3, "Reports", frmReportsPane.hWnd)
    Set Item = wndShortcutBar.AddItem(4, "Schedules", 0)
    Set Item = wndShortcutBar.AddItem(5, "Export Tables", frmExportTablesPane.hWnd)
 
When one of the shortcuts is selected, the following runs which displays the selected form on the B pane:
 
Select Case Item.Id
Case 1
    frmMain.B.Handle = frmSelections.hWnd
Case 2
    frmMain.B.Handle = frmUserTables.hWnd
Case 3
    frmMain.B.Handle = frmReports.hWnd
Case 5
    frmMain.B.Handle = frmExpDataSetup.hWnd
 
My Point......
 
While this works fine as a stand alone Exe project, if I try and convert it to an OCX, thus making frmMain a User Control it stops working.
 
Setting the handles in the user control and the handle changes in frmTreeViewPane work fine, but these ones don't work:
    frmMain.B.Handle = frmExpDataSetup.hWnd
    etc
 
I assume it's because I'm referencing the User Control from the outside.  A and B Panes were declared as public but still it returns
 
Object variable or With block variable not set
 
Does anyone have any idea where i'm going wrong?
 
Hopefully i've described that well enough but if anything is unclear please let me know.
 
Regards,
Phil
 
 



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