Hello... I'm a relative newbie to vb.net, OOP, and programming in general. (I accidently hit the "programmer" selection when setting up my account... can't say the adjective really applies... unless you count my Fortran 77 training 10+ years ago.
)
I have a TabPage with a button. The call on the button click is supposed to add another TabPage to the current TabPage's parent TabControl. I then want to make the new TabPage the "selected" page. I was hoping I could use:
Problem is, the compiler says that the "SelectedTab" method does not exist for "System.Windows.Forms.Control"...
I guess this makes sense, as the method "Parent" returns a control. Funny thing is, if a do a
I get: "System.Windows.Forms.TabControl"
Which also makes sense. Anyway, I have written a workaround by passing the tabcontrol reference around, but it seems very inelligent to me. Besides, it is obvious I am missing a concept here.
Can anyone help?
Thank you!
![[wink] [wink] [wink]](/data/assets/smilies/wink.gif)
I have a TabPage with a button. The call on the button click is supposed to add another TabPage to the current TabPage's parent TabControl. I then want to make the new TabPage the "selected" page. I was hoping I could use:
Code:
Dim newPage As TabPage = new TabPage()
me.Parent.Controls.Add(newPage)
me.Parent.SelectedTab = newPage
I guess this makes sense, as the method "Parent" returns a control. Funny thing is, if a do a
Code:
MessageBox.Show(me.Parent.GetType.ToString)
Which also makes sense. Anyway, I have written a workaround by passing the tabcontrol reference around, but it seems very inelligent to me. Besides, it is obvious I am missing a concept here.
Can anyone help?
Thank you!