Results 1 to 3 of 3

Thread: [RESOLVED] TabControl in realtime

  1. #1

    Thread Starter
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Resolved [RESOLVED] TabControl in realtime

    Hi all,

    I have hit a brick wall with my latest project.

    In essence the entire tab control is created on the fly, i have successfully added any number of tabs with the tabpage title being filled correctly. my problem however is when i add the content itself to the correct page, i have no item displayed on any tabs and however i can retrieve the contents and change them with code.

    My code takes a pricelist xml file from my works website and my code is supposed to allow this content to be edited and returned to the server with adjusted prices to reflect updates in our costing. All the code works except the part to display the data, and consequently the code to use this data to update the array used for the xml while the program is running is not written.

    Here is the display code which does not work:-
    vb.Net Code:
    1. Private Sub DisplayArray()
    2.         ' we have the array and need to output it for editing
    3.         For a = 0 To usrArray.GetLength(0) - 1
    4.             Dim page As New TabPage
    5.             page.Name = "Tab" + a.ToString
    6.             Dim tlp As New TableLayoutPanel
    7.             Dim x(,) As String = usrArray(a, 2)
    8.             For b = 0 To x.GetLength(0) - 1
    9.                 Dim lblA As New Label
    10.                 Dim txtA As New TextBox
    11.                 lblA.Text = x(b, 0) + " is " + x(b, 1) + "="
    12.                 lblA.Name = "lbl_" + a.ToString + "_" + b.ToString
    13.                 txtA.Text = x(b, 2)
    14.                 txtA.Name = "txt_" + a.ToString + "_" + b.ToString
    15.                 tlp.Controls.Add(lblA)
    16.                 tlp.Controls.Add(txtA)
    17.             Next
    18.             page.Controls.Add(tlp)
    19.             TabControl1.TabPages.Add(page.Name, usrArray(a, 0).ToString + "=" + usrArray(a, 1).ToString)
    20.         Next
    21.         For a = 0 To usrArray.GetLength(0) - 1
    22.  
    23.         Next
    24.     End Sub
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  2. #2

    Thread Starter
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: TabControl in realtime

    ok i found editing line 19. to page.Controls.Add(tlp) helped but only the first 2 elements are found and the content of the labels beyond the first page is not calculated correctly despite the array being correct (verified by filling the array and then outputting the array to an xml file and comparing the results with the original)
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

  3. #3

    Thread Starter
    Fanatic Member Megalith's Avatar
    Join Date
    Oct 2006
    Location
    Secret location in the UK
    Posts
    879

    Re: TabControl in realtime

    well turns out it was the container i was using, when i used a groupbox instead of a tablelayoutpanel it worked flawless. So thread is resolved...
    If debugging is the process of removing bugs, then programming must be the process of putting them in.

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