That is what I thought. But I am having difficulties initiated the 2 control. The first one works perfect but am not quite sure how to get the second one to initiate.
Code for Custom Tabpage Class Code:
Public Class TabPageEx Inherits System.Windows.Forms.TabPage Private WithEvents uc As New UserControl1 Private WithEvents uc2 As New UserControl2 Public Sub New() Me.uc.Margin = New Padding(0) Me.uc.Dock = DockStyle.Fill Me.Controls.Add(Me.uc) Me.UseVisualStyleBackColor = True Me.uc2.Margin = New Padding(0) Me.uc2.Dock = DockStyle.Fill Me.Controls.Add(Me.uc2) Me.UseVisualStyleBackColor = True End Sub Private Sub InitializeComponent() End Sub End Class
Here is the button click event that adds the tabpage.
Code Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Mytab As New TabPageEx frmPrefsDialog.TabControl1.TabPages.Add(Mytab) Mytab.Text = RichTextBox1.Text frmPrefsDialog.TabControl1.SelectedTab = Mytab Me.Close() End Sub
Now I am struggle on how to inititiate the second usercontrol still using the TabPageEx Class. Do I need to make another seperate Class Such as TabpageEx2 too handle usercontrol2? The usercontrol2 needs to happen on form load so that the tab is always present. This may be a simply answer and apologize. I truly am trying to learn this at times gets so confusing.
I realized that this should be another topic. Mod please mark this as resolved
Thanks Again




Reply With Quote