I had a search for this and found something about mimicing the enabling and disabling of tabpages but unfortunately couldn't convert it from C# (im a beginner and only with vb).
I have a shared variable called op as a string. It has three states, "Add", "Edit" and "Delete".
When i open the form (with three different buttons) it changes the variable as required.
I have three tabpages add, edit and delete and i want the other two to be unselectable.( I didn't want three different forms).
Is there any way i can do this I tried playing with the tabcontrol_selecting method, but have had no success.
Cheers.
-- Ash Clarke

Tab pages- enabling and disabling (or mimicing as seen in C# thread)
Critcho
Thanks so much Shakalama, this is just what i needed.
I did notice one problem as i was coding it:
The line: Savedpage1 = Me.TabControl1.TabPages(1)
Should read: Savedpage1 = Me.TabControl1.TabPages(0)
For anyone who didn't know, Tabpages in the collection dialogue always start with 0 then 1 then 2, for tabpage1, tabpage2 and tabpage3 etc.
Anyway, thanks again, like i said, exactly what i needed.
Cheers
-- Ash Clarke
Srreh
Yeah i know, i wanted to write that, but just couldnt think how to say it.
Cheers
-- Ash Clarke
Joe McGrath
hi,
you want to hide first tabpage i wanted to hide the second anyway which tab page is not the problem the problem was the way how to do it if you want to control many pages you just save them one by one or even you can make array of them and to hide and show which page you want
hope this helps
dronick
ok,jmc
for me i have a form that will capture loads of data entery per record i divided them in 8 groups of data in 8 tabpages, and those records depending on other data entery like for example if textbox1.text < 10$ then textbox2.enable = false , but in a big scale you may be disable 5 textbox's (ie entire tabpage)
now i remove the tabpage and show it again but if i were able to disable it , it will looks better
best regards
dredrunde
Basically, as others have said, this is bad UI. If something exists on a tab page, users expect to be able to select it, even if the contents may be disabled. Adding/removing tab pages is a better solution if you must use tab pages. If only one is available at a time, then they should be three forms, or one form with three composite controls, which get shown/hidden so the right one is visible every time.
spillai
Seb_london
@ Shakalama - C# Thread
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=13077&SiteID=1
@jmcilhinney and cgraus
I have my reasons, the main being that i would have to create 7 more forms instead of two.
I think i might rethink my choice of a tabcontrol (it does look pretty) and just use panels instead.
Cheers for your comments
-- Ash Clarke
Big H
hi,
actualy i'm searching for that in C# if you don't mind give me the link to it and i'll convert it to you in VB
thx
Mike12345
jinjun
hi,
first of all if you check this link again you will find that trick didn't work, neither in c# or VB so you have to search for other solution, anyway for myself i used hide/show the tabcontrol
this is a tabcontrol with 2 tabpages , tabpage one contain checkbox used to hide tabpage2 take care from the page names it will confuse you like it did to me, so name the tabpages again with meaningfull name
Public Class Form1
Dim Savedpage1 As TabPage
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'save the pages to be able to remove them and themm again without losing controls
Savedpage1 = Me.TabControl1.TabPages(1)
End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then showpage(Me.TabPage2, Savedpage1)
Else HidePage(Me.TabPage2)
End If End Sub Private Sub ShowPage(ByVal Tb As TabPage, ByVal saved As TabPage)
If Not TabControl1.TabPages.Contains(Tb) Then TabControl1.TabPages.Add(saved)
End If End Sub Private Sub HidePage(ByVal Tb As TabPage)
If TabControl1.TabPages.Contains(Tb) Then Dim index As Integer = TabControl1.TabPages.IndexOf(Tb)
TabControl1.TabPages.RemoveAt(index)
End If End Sub
End Class
hope this will help