PC Review


Reply
Thread Tools Rate Thread

Diabling Tabpage

 
 
Raju Shrestha
Guest
Posts: n/a
 
      10th Dec 2003
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!
 
Reply With Quote
 
 
 
 
Claes Bergefall
Guest
Posts: n/a
 
      10th Dec 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      10th Dec 2003
* Raju Shrestha <(E-Mail Removed)> 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>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
diabling save =?Utf-8?B?RWxlbmE=?= Microsoft Excel Programming 5 17th May 2005 07:27 PM
BUG? TabPage.Enable and TabPage.Visible don't quite work Richard Thombs Microsoft Dot NET Compact Framework 1 20th Jul 2004 06:24 PM
Diabling right-click John Microsoft Windows 2000 Group Policy 1 21st May 2004 12:51 PM
Diabling Windows+L =?Utf-8?B?aGFyaXNo?= Windows XP Security 0 14th Jan 2004 04:21 PM
How do I go about diabling 3D Screen Savers in Win XP? Lynn Hammel Windows XP Setup 1 27th Aug 2003 10:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:55 AM.