PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Diabling Tabpage
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Diabling Tabpage
![]() |
Diabling Tabpage |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I tried to disable a tabpage by using tp.Enabled = False. It disables
all the controls contained on that tabpage but still I can move focus to that tabpage which is not as expected. What is the workaround of this problem? Appreciate for the answer. Thanks Raju Shrestha *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Try this:
Public Class TabControlEx Inherits TabControl Private Const WM_LBUTTONDOWN As Integer = &H201 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) If m.Msg = WM_LBUTTONDOWN Then Dim pt As New Point(m.LParam.ToInt32) Dim index As Integer For index = 0 To Me.TabPages.Count - 1 If GetTabRect(index).Contains(pt) Then If TabPages(index).Enabled Then MyBase.WndProc(m) End If Exit Sub End If Next End If MyBase.WndProc(m) End Sub Protected Overrides Sub OnKeyDown(ByVal ke As System.Windows.Forms.KeyEventArgs) Dim currentIndex As Integer = Me.SelectedIndex Dim index As Integer If ke.KeyCode = Keys.Left AndAlso Not (ke.Alt AndAlso Not ke.Control) Then For index = currentIndex - 1 To 0 Step -1 If TabPages(index).Enabled Then Me.SelectedIndex = index Exit For End If Next ke.Handled = True ElseIf ke.KeyCode = Keys.Right AndAlso Not (ke.Alt AndAlso Not ke.Control) Then For index = currentIndex + 1 To TabPages.Count - 1 If TabPages(index).Enabled Then Me.SelectedIndex = index Exit For End If Next ke.Handled = True End If MyBase.OnKeyDown(ke) End Sub End Class /claes "Raju Shrestha" <rajustha2000@yahoo.com> wrote in message news:uDhw9IsvDHA.2460@TK2MSFTNGP10.phx.gbl... > I tried to disable a tabpage by using tp.Enabled = False. It disables > all the controls contained on that tabpage but still I can move focus to > that tabpage which is not as expected. What is the workaround of this > problem? > Appreciate for the answer. > Thanks > > Raju Shrestha > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! |
|
|
|
#3 |
|
Guest
Posts: n/a
|
* Raju Shrestha <rajustha2000@yahoo.com> scripsit:
> I tried to disable a tabpage by using tp.Enabled = False. It disables > all the controls contained on that tabpage but still I can move focus to > that tabpage which is not as expected. What is the workaround of this > problem? This code shows how to detect when the selected tab changes: <http://www.google.de/groups?selm=hxAg9.261485%24kp.887854%40rwcrnsc52.ops.asp.att.net> Maybe you can use it. -- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

