Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

programmatically add name to TabControl based on ComboBox selection

$
0
0
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

    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 = NodeCount.ToString
                        .SubItems.Add(myMachineName.InnerText)
                    End With
                    TabControl1.Items.Add(TCI)
                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)
<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>


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>