Řeším téměř stejný problém. Již jsem něco vyzkoušel, ale zatím nemám hotový kód, tak jen rámcově a s rezervou: 1)Vytvořil jsem si formulář (FormNumPad) 2)Vytvořil jsem si komponentu v novém modulu (NumPad) odvozenou od System.ComponentModel.Component s instancí FormNumPad 3)do předchozího modulu jsem sloučil kódy co jsem napsal a co vytvořil Designer (designer.vb) a doplnil konstruktor formuláře
Imports System.Windows.Forms
Public Class NumPad01
Private UserForm As New FormNumPad
Public Sub Show()
UserForm.ShowDialog()
End Sub
End Class
Public Class FormNumPad
#Region "Designer Added"
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
' <System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public Sub New()
InitializeComponent()
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
' <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(72, 32)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(69, 81)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1"
'
'Form2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form2"
Me.Text = "Form2"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
#End Region
|