Results 1 to 12 of 12

Thread: [RESOLVED] Help with list box items and Textbox

Threaded View

  1. #12

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    27

    Re: Help with list box items and Textbox

    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:
    1. Public Class TabPageEx
    2.     Inherits System.Windows.Forms.TabPage
    3.  
    4.     Private WithEvents uc As New UserControl1
    5.     Private WithEvents uc2 As New UserControl2
    6.  
    7.  
    8.     Public Sub New()
    9.         Me.uc.Margin = New Padding(0)
    10.         Me.uc.Dock = DockStyle.Fill
    11.         Me.Controls.Add(Me.uc)
    12.         Me.UseVisualStyleBackColor = True
    13.         Me.uc2.Margin = New Padding(0)
    14.         Me.uc2.Dock = DockStyle.Fill
    15.         Me.Controls.Add(Me.uc2)
    16.         Me.UseVisualStyleBackColor = True
    17.     End Sub
    18.  
    19.  
    20.     Private Sub InitializeComponent()
    21.  
    22.     End Sub
    23.    
    24. End Class

    Here is the button click event that adds the tabpage.

    Code Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.  
    3.         Dim Mytab As New TabPageEx
    4.         frmPrefsDialog.TabControl1.TabPages.Add(Mytab)
    5.         Mytab.Text = RichTextBox1.Text
    6.         frmPrefsDialog.TabControl1.SelectedTab = Mytab
    7.  
    8.         Me.Close()
    9.  
    10.     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
    Last edited by RCA20; Dec 24th, 2009 at 07:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width