Ok what I am doing is from a blank from add a Tab Control with No Tabs. Then add 2 buttons to the form.
I add a tab via code and then add a panel inside the tab and change the color to green.
Now in another sub I want to change the Panel color to pink but I am not sure how to access it without changing the scope.
here is the code.
[code]
Public Class Form1
Dim TabInstance As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myTabPage As New TabPage()
Dim myPanel As New Panel()
myTabPage.Name = TabInstance
myTabPage.Text = CStr(TabInstance)
TabControl1.TabPages.Add(myTabPage)
TabControl1.SelectedTab = myTabPage
myPanel.Dock = DockStyle.Fill
myPanel.Visible = True
myPanel.BackColor = Color.Green
myPanel.Name = "testPanel"
myTabPage.Controls.Add(myPanel)
'set counter for next time
TabInstance = TabInstance + 1
End Sub
Public Sub ChangeTabPanelColor()
'change the color of the panel in the first tab
'TabControl1.TabPages(0).panel.BackColor = Color.HotPink
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ChangeTabPanelColor()
End Sub
End Class
[/code]
Any help would be appreciated.