|
-
May 12th, 2011, 09:14 AM
#1
Thread Starter
Fanatic Member
[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:
Private Sub DisplayArray()
' we have the array and need to output it for editing
For a = 0 To usrArray.GetLength(0) - 1
Dim page As New TabPage
page.Name = "Tab" + a.ToString
Dim tlp As New TableLayoutPanel
Dim x(,) As String = usrArray(a, 2)
For b = 0 To x.GetLength(0) - 1
Dim lblA As New Label
Dim txtA As New TextBox
lblA.Text = x(b, 0) + " is " + x(b, 1) + "="
lblA.Name = "lbl_" + a.ToString + "_" + b.ToString
txtA.Text = x(b, 2)
txtA.Name = "txt_" + a.ToString + "_" + b.ToString
tlp.Controls.Add(lblA)
tlp.Controls.Add(txtA)
Next
page.Controls.Add(tlp)
TabControl1.TabPages.Add(page.Name, usrArray(a, 0).ToString + "=" + usrArray(a, 1).ToString)
Next
For a = 0 To usrArray.GetLength(0) - 1
Next
End Sub
If debugging is the process of removing bugs, then programming must be the process of putting them in.
-
May 12th, 2011, 10:00 AM
#2
Thread Starter
Fanatic Member
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.
-
May 15th, 2011, 04:16 AM
#3
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|