Tab Control in VB.Net

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 9
Reputation: mpatram is an unknown quantity at this point 
Solved Threads: 0
mpatram mpatram is offline Offline
Newbie Poster

Tab Control in VB.Net

 
0
  #1
Mar 18th, 2008
Hi All,

I m working on a TabControl in Vb.Net. Its having 4 tabpages. like Tab1, Tab2, Tab3, Tab4. On Tab1 I m having a checkBox.

My requirement is when checkBox.Checked=True it will enable the Tab2. How can I go for this?

Note: I m not selecting the Tab2


Plz give me few sugestion

Thanks
M Patra
SSE
AISL, India
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Tab Control in VB.Net

 
0
  #2
Mar 18th, 2008
You can do it by using 2 methods first
TabControl.SelectedTab = TabPage
or
TabControl.SelectedIndex = theNumberOfTabSelected
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 31
Reputation: BluePaper is an unknown quantity at this point 
Solved Threads: 0
BluePaper's Avatar
BluePaper BluePaper is offline Offline
Light Poster

Re: Tab Control in VB.Net

 
-1
  #3
Mar 18th, 2008
So you want to have the second tab disabled until they check this checkbox?

Well, after fiddling around for a little bit (I'm rather new to Visual Basic so maybe this could be done better) I've found out that there is no 'obvious' enabled state of the tab. The intellisense doesn't pick it up and it's not in the properties panel but you can set it through using: TabPageName.Enabled = False set that when the form loads, the user can still click the tab but all the controls within that tab are disabled (I don't know how to disable the tab entirely sorry :/)

  1. Private Sub checkbox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles checkBox.CheckedChanged
  2.  
  3. If checkBox.Checked = True Then
  4. TabPageName.Enabled = True
  5. ElseIf checkBox.Checked = False Then
  6. TabPageName.Enabled = False
  7. End If
  8.  
  9. End Sub

So make sure you set the Enabled State of the TabPage to False and then use that code, edit it to your hearts delight to enable the page. Maybe someone else knows how to disable the tab altogether but here's my suggestion.

(My tabs are messed up in my code, so be aware.)
Stone In Focus - Caffeine Group - CoffeePHP - Open Notes - Onyx - Redpoint Network - Espresso
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 11
Reputation: kimbula... is an unknown quantity at this point 
Solved Threads: 0
kimbula... kimbula... is offline Offline
Newbie Poster

Re: Tab Control in VB.Net

 
0
  #4
Jun 22nd, 2009
Although you have mention a way to disable tab controls in vb.net that wasn't working
Don't know the reason
I'm using VB.Net 2005 it doesn't have enabled property for tabpages.
Therefore once you type as follows it will prompt an error message

TabPageName.Enabled=true


Enabled is not a property of TabPage

So if you find another way to disable tab pages please post it
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 2
Reputation: Romit Dutta is an unknown quantity at this point 
Solved Threads: 0
Romit Dutta Romit Dutta is offline Offline
Newbie Poster

Re: Tab Control in VB.Net

 
0
  #5
Jun 27th, 2009
Try it...........It is tested. It's working.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TabControl1.SelectedTab = TabPage2
End If
End Sub

Thank you.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 11
Reputation: kimbula... is an unknown quantity at this point 
Solved Threads: 0
kimbula... kimbula... is offline Offline
Newbie Poster

Re: Tab Control in VB.Net

 
-1
  #6
Jun 29th, 2009
you are specifying a way to select the tab when some control had been changed.But what i want to do is to disable the tab page when i change a control.

What I got to know is there is no way to disable a tab page in VB.Net

So i have tried inserting a panel in to the tab page and put all controls in to that panel. Thereby making the panel disabled when a control had been changed.

This way i got the thing i want to do.

Thanx for your support
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 2
Reputation: Romit Dutta is an unknown quantity at this point 
Solved Threads: 0
Romit Dutta Romit Dutta is offline Offline
Newbie Poster

Re: Tab Control in VB.Net

 
0
  #7
Jun 29th, 2009
Kimbula, there is no enable or disable property in a single tabpage.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: ohitsdom is an unknown quantity at this point 
Solved Threads: 0
ohitsdom ohitsdom is offline Offline
Newbie Poster

Remove tab

 
0
  #8
30 Days Ago
kimbula,
I know this thread is a bit old but I wanted to propose another option. You could have the tab removed (made invisible) when the form loads, then add it back when the user checks the checkbox.

To remove the tab:
  1. TabControl1.Controls.Remove(tab2)

To add:
  1. TabControl1.Controls.Add(tab2)
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 1
Reputation: M ALAM is an unknown quantity at this point 
Solved Threads: 0
M ALAM M ALAM is offline Offline
Newbie Poster
 
0
  #9
20 Days Ago
hi i want to join u;;;;;
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC