Results 1 to 14 of 14

Thread: [02/03] Multiple Tab Pages with Copy of Master Form

  1. #1

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Question [02/03] Multiple Tab Pages with Copy of Master Form

    Hi All,

    VB.Net 02 and SQL2003

    I do not know if this is possible, but it would be very efficient for recording group counseling sessions that could have up to 25 participants at a time.

    Here what I would like to do:

    On a form I have put a tab control client and added two tab pages.

    On the first tab page which will act as the primary group configuration page I put a From Date and To Date text box, the Counselor ID text box, 3 Session number radio buttons, and finally a drop down combo box which will be used to select the multiple client consumers that has attended the group session.

    On the second tab page I placed several text boxes which would serve as the master input form or template as it may be considered as.

    After selecting the multiple clients on the drop down combo, I would like to load a tab page with a copy of the master form (template form) for each client selected so that the entry person can select back and forth between the few or many attendees and enter data.

    Can it be done?
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    add a new tabpage for each client

    vb.net Code:
    1. Tabcontrol1.TabPages.Add("new tab")

    then add new controls to each tabpage

    vb.net Code:
    1. Dim txtBx As New TextBox
    2. Tabcontrol1.TabPages("new tab").Controls.Add(txtBx)

  3. #3

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    I think I am going to need some type of formatting to copy the main template tab page.
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    another way is to design a third tabpage, with the same controls as your main template tab page, and set visible = false.
    then when you need a new tabpage

    vb Code:
    1. TabControl1.TabPages.Add(TabControl1.TabPages(2))
    2. TabControl1.TabPages(TabControl1.TabPages.Count - 1).Text = "your text"
    3. TabControl1.TabPages(TabControl1.TabPages.Count - 1).Show()

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    i'm assuming you don't want a combobox with all your clients listed on each clients tabpage?

  6. #6

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    The first tab page is the control of the Forms/TabPage it determines how many tab pages will be created.

    The second tab page is the template of what I want to replicate onto other tab pages
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    this works in vb2005

    vb Code:
    1. TabControl1.TabPages.Add("your text")
    2. TabControl1.TabPages(TabControl1.TabPages.Count - 1).Show()
    3. For Each ctrl As Control In TabControl1.TabPages(1).Controls
    4.      Dim newCtrl As Control = Nothing
    5.      If TypeOf ctrl Is Label Then
    6.          newCtrl = New Label
    7.      ElseIf TypeOf ctrl Is TextBox Then
    8.          newCtrl = New TextBox
    9.      ElseIf TypeOf ctrl Is Button Then
    10.          newCtrl = New Button
    11.      End If
    12.      newCtrl.Top = ctrl.Top
    13.      newCtrl.Left = ctrl.Left
    14.      newCtrl.Text = ctrl.Text
    15.      TabControl1.TabPages(TabControl1.TabPages.Count - 1).Controls.Add(newCtrl)
    16. Next

  8. #8

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    I used this, but it over writes tabpage2 and bombs out at about the 8th page added without throwing an error.

    Code:
    TabCtrlClient.TabPages.Add(TabPage2)
    
            TabCtrlClient.TabPages(TabCtrlClient.TabPages.Count - 1).Show()
            For Each ctrl As Control In TabCtrlClient.TabPages(1).Controls
                Dim newCtrl As Control = Nothing
                If TypeOf ctrl Is Label Then
                    newCtrl = New Label
                ElseIf TypeOf ctrl Is TextBox Then
                    newCtrl = New TextBox
                ElseIf TypeOf ctrl Is Button Then
                    newCtrl = New Button
                End If
                newCtrl.Top = ctrl.Top
                newCtrl.Left = ctrl.Left
                newCtrl.Text = ctrl.Text
                TabCtrlClient.TabPages(TabCtrlClient.TabPages.Count - 1).Controls.Add(newCtrl)
            Next
    
        End Sub
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    don't use:

    vb Code:
    1. TabCtrlClient.TabPages.Add(TabPage2)

    you're adding a new tabpage, then populating it with identical controls to TabPage2, not copying TabPage2

    vb Code:
    1. TabCtrlClient.TabPages.Add("new tabpage title")

  10. #10

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    That does not work in 02

    Value of type 'String' cannot be converted to 'System.Windows.Form.Tabpage'
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  11. #11
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    try adding a 3rd blank tabpage at design time, + setting .visible = false

    then (check the overloads)

    vb Code:
    1. TabCtrlClient.TabPages.Add(TabPage3)
    or
    vb Code:
    1. TabCtrlClient.TabPages.Add(index)

  12. #12

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    Is there a way to then Clone or Copy Tabpage 2?
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

  13. #13
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [02/03] Multiple Tab Pages with Copy of Master Form

    no i don't think so. i'm using vb2005, but when i tried it the way you mean, it removed all the controls from tabpage2.

    the only way i could get it working is to add a new blank page, then add new controls, identical to those on tabpage2

  14. #14

    Thread Starter
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 2006
    Location
    Alabama USA
    Posts
    417

    Red face Re: [02/03] Multiple Tab Pages with Copy of Master Form

    If there is not a clone command then there should be a procedure for copying the objects from a screen to another.

    Create the tabpage, insert the objects.
    If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.

    "I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison

    Do illiterate people get the full effect of Alphabet Soup?

    ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool

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