if the button is on the child why do you need to generate it from the mdi form? if you want help provide the needed details and put code in the code or vbcode tags
here though:
VB Code:
Option Explicit On Option Strict On Imports Microsoft.VisualBasic Imports System Imports System.Drawing Imports System.Windows.Forms Namespace mdiExample Public Class mdi : Inherits Form <STAThread()> _ Public Shared Sub Main() System.Windows.Forms.Application.Run(new mdi()) End Sub Public Sub New() MyBase.New() Me.IsMdiContainer = True Me.Text = "MDI Example" Me.Show Dim i As Short = 0 Dim frm As mdiChild For i = 0 To 9 frm = new mdiChild frm.MdiParent = Me frm.Text = CStr(i) frm.Show Next i End Sub End Class Public Class mdiChild : Inherits Form Public Sub New() MyBase.New Dim btn As new Button btn.Text = "A Button" btn.Location = new Point(120,6) Me.Controls.Add(btn) AddHandler btn.Click, AddressOf Me.btn_Click End Sub Private Sub btn_Click(sender As Object, e As EventArgs) MsgBox("A Button") End Sub End Class End Namespace




Reply With Quote