How to change the Tabcontrol name based on Combobox selection

RoyLittle0

Active member
Joined
Nov 17, 2012
Messages
38
Location
Derby, Uk
Programming Experience
Beginner
Can anyone explain how to change the text in a TabControl, i have tried to use the sane tactics i would with a ListView but cant seem to get it right

The name is being read from an xml file based on the selection made from the ComboBox, and from there it will display the contents of the xml in 3 textBoxes and 3 PictureBoxes

VB.NET:
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Dim NodeCount As Integer


        For Each mySet As XmlNode In myXMLDoc.GetElementsByTagName("Machine")
            If mySet.Attributes.ItemOf("Type").InnerText = ComboBox1.SelectedItem.ToString Then


                For Each myMachineName As XmlNode In mySet.SelectNodes("Page")
                    NodeCount += 1
                    Dim TCI As New TabControl
                    With TCI
                        .Text = (myMachineName.InnerText)
                    End With

                Next


            End If
        Next
    End Sub

There are 10 machines in total, each having 20 pages and the Text and PictureBoxes will display the data based on teh selection, ie, Machine Type (ComboBox), Page Number (TabControl)
VB.NET:
<Root>
    <Machine Type="A Machine">
        <Page Number="Page 1, Machine A">
            <Title>1</Title>
            <TextBox>2</TextBox>
            <TextBox>3</TextBox>
            <TextBox>4</TextBox>        
            <PictureBox>5</PictureBox>
            <PictureBox>6</PictureBox>
            <PictureBox>7</PictureBox>
            <Link>8</Link>
        </Page>
        <Page Number="Page 2, Machine A">
            <Title>9</Title>
            <TextBox>10</TextBox>
            <TextBox>11</TextBox>
            <TextBox>12</TextBox>        
            <PictureBox>13</PictureBox>
            <PictureBox>14</PictureBox>
            <PictureBox>15</PictureBox>
            <Link>16</Link>        
        </Page>
        <Page Number="Page 3, Machine A">
            <Title>17</Title>
            <TextBox>18</TextBox>
            <TextBox>19</TextBox>
            <TextBox>20</TextBox>        
            <PictureBox>21</PictureBox>
            <PictureBox>22</PictureBox>
            <PictureBox>23</PictureBox>
            <Link>24</Link>        
        </Page>
    </Machine>
</Root>
 
Last edited:
Firstly, if you have an existing TabControl with several TabPages, you're not modifying the existing control in any way because you're instantiating a new TabControl class that you're editing. Also, what I think you want is to edit the TabPages, not the TabConrol because the TabPages are the visible tabs within the control, so this may be the second part to your problem.
 
Back
Top