Click here to Skip to main content
15,903,203 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Add Combobox to Datagridview at runtime. Pin
dan!sh 17-Jun-10 5:43
professional dan!sh 17-Jun-10 5:43 
GeneralRe: Add Combobox to Datagridview at runtime. Pin
Nielvh18-Jun-10 11:18
Nielvh18-Jun-10 11:18 
QuestionPassing Events Pin
Sonhospa17-Jun-10 3:11
Sonhospa17-Jun-10 3:11 
AnswerRe: Passing Events Pin
EliottA17-Jun-10 3:49
EliottA17-Jun-10 3:49 
NewsRe: Passing Events Pin
Sonhospa17-Jun-10 5:03
Sonhospa17-Jun-10 5:03 
QuestionRe: Passing Events Pin
DaveAuld17-Jun-10 3:58
professionalDaveAuld17-Jun-10 3:58 
NewsRe: Passing Events Pin
Sonhospa17-Jun-10 5:17
Sonhospa17-Jun-10 5:17 
GeneralRe: Passing Events Pin
DaveAuld17-Jun-10 5:53
professionalDaveAuld17-Jun-10 5:53 
Michael,

I just setup a new forms project;

1) Created an MDI form that had a single Panel to act as the container for the plugin Form
In the mdi form load event i called a sub which created the plugin class instance;
Private Plugin As PlugInClass

Private Sub MDIParent1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    AddChildFormToPanel()
End Sub

Private Sub AddChildFormToPanel()
    Plugin = New PlugInClass(Me.FormPluginContainer)
End Sub


2) Created a Plugin Class which instantiates the form and loads it into the panel of the mdiform, the class also has a sub which handles the forms event.
Public Class PlugInClass

    Private WithEvents m_mainform As FormPlugin

    Public Sub New(ByRef TargetPanel As Panel)

        m_mainform = New FormPlugin
        With m_mainform
            .TopLevel = False
            .FormBorderStyle = FormBorderStyle.None
            .Dock = DockStyle.Left
            TargetPanel.Controls.Add(m_mainform)
            .Visible = True
        End With

    End Sub

    Private Sub thePluginFormRaisedAnEvent() Handles m_mainform.ButtonPressed
        MsgBox("The Plug In Form Raised An Event in the PlugInClass")
    End Sub

End Class


3) Created a PlugIn Form with a single button, that raises an event when clicked.
Public Event ButtonPressed()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    RaiseEvent ButtonPressed()
End Sub


Ran the project, the form was created and loaded into the mdiform panel.
When the button is clicked the Class happily raises the message box.

I think this is what you are trying to do, and it appears to work just fine, although i didn't use any AddHandler calls, and passed in ByRef the panel where the form should be placed in the constructor for the class.

All appears to work fine.
Dave

Don't forget to rate messages!
Find Me On: Web|Facebook|Twitter|LinkedIn
Waving? dave.m.auld[at]googlewave.com


GeneralRe: Passing Events Pin
Sonhospa17-Jun-10 6:17
Sonhospa17-Jun-10 6:17 
NewsResolved: Passing Events Pin
Sonhospa17-Jun-10 7:33
Sonhospa17-Jun-10 7:33 
GeneralRe: Resolved: Passing Events Pin
DaveAuld17-Jun-10 7:43
professionalDaveAuld17-Jun-10 7:43 
QuestionVisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
QuickBooksDev17-Jun-10 1:56
QuickBooksDev17-Jun-10 1:56 
AnswerRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
Luc Pattyn17-Jun-10 2:19
sitebuilderLuc Pattyn17-Jun-10 2:19 
GeneralRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
QuickBooksDev19-Jun-10 2:14
QuickBooksDev19-Jun-10 2:14 
AnswerRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
AnnieMacD17-Jun-10 2:46
AnnieMacD17-Jun-10 2:46 
GeneralRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
QuickBooksDev19-Jun-10 2:11
QuickBooksDev19-Jun-10 2:11 
GeneralRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
AnnieMacD19-Jun-10 2:35
AnnieMacD19-Jun-10 2:35 
GeneralRe: VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
QuickBooksDev21-Jun-10 6:47
QuickBooksDev21-Jun-10 6:47 
GeneralRe: HELP!!! There must be a setting or something. VisStudio 2005 (VB) to VS 2008/2010 migration errors exit function without message Pin
QuickBooksDev23-Jun-10 5:19
QuickBooksDev23-Jun-10 5:19 
Questionchanging monitor screen resolution Pin
phowarso16-Jun-10 21:08
phowarso16-Jun-10 21:08 
AnswerRe: changing monitor screen resolution Pin
Dave Kreskowiak17-Jun-10 1:38
mveDave Kreskowiak17-Jun-10 1:38 
QuestionHow do I connect vb 2005 and Access 2007 in published application [modified] Pin
cyberexel16-Jun-10 12:14
cyberexel16-Jun-10 12:14 
AnswerRe: How do I connect vb 2005 and Access 2007 in published application Pin
Dave Kreskowiak17-Jun-10 1:36
mveDave Kreskowiak17-Jun-10 1:36 
GeneralRe: How do I connect vb 2005 and Access 2007 in published application Pin
cyberexel17-Jun-10 8:11
cyberexel17-Jun-10 8:11 
GeneralRe: How do I connect vb 2005 and Access 2007 in published application Pin
Dave Kreskowiak17-Jun-10 8:25
mveDave Kreskowiak17-Jun-10 8:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.