473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can I catch tab change on a TabControl?

I would like to catch the tab change before it occurs. There is a
SelectedIndexChanged event to catch the change after it occurs. How do I
catch when the user clicks on a tab, but before the TabPage changes?

Is there anything like the TCN_SELCHANGING notification?

TIA

David Rose

Nov 15 '05 #1
3 49418
Nicholas,

Thanks. That works fine.

I was hoping that there would be an easier way, but I guess that for some
reason that event is not handled in .NET.

David
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OK**************@TK2MSFTNGP09.phx.gbl...
David,

You should be able to hook into the windows procedure of the parent of
the tab control and catch that notification. You just have to override the WndProc method on that container.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"David Rose" <da***@silverswitch.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to catch the tab change before it occurs. There is a
SelectedIndexChanged event to catch the change after it occurs. How do I catch when the user clicks on a tab, but before the TabPage changes?

Is there anything like the TCN_SELCHANGING notification?

TIA

David Rose


Nov 15 '05 #2
You could use the MouseDown event to determine that the user has clicked on
the tab contol and then check to see what tab was clicked.

Mike Shane
MST Associates

"David Rose" <da***@silverswitch.net> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Nicholas,

Thanks. That works fine.

I was hoping that there would be an easier way, but I guess that for some
reason that event is not handled in .NET.

David
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:OK**************@TK2MSFTNGP09.phx.gbl...
David,

You should be able to hook into the windows procedure of the parent of
the tab control and catch that notification. You just have to override the
WndProc method on that container.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"David Rose" <da***@silverswitch.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I would like to catch the tab change before it occurs. There is a
SelectedIndexChanged event to catch the change after it occurs. How

do I catch when the user clicks on a tab, but before the TabPage changes?

Is there anything like the TCN_SELCHANGING notification?

TIA

David Rose



Nov 15 '05 #3
Mike,

That was the first thing I tried. For some reason that event fires after
the SelectedIndexChanged event for the TabControl. I am not sure how
Windows Forms routes events. Know a good source of information on Forms
event routing?

Handling the WM_NOTIFY message works as expected.

David
"Mike Shane" <mi********@msta.com> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
You could use the MouseDown event to determine that the user has clicked on the tab contol and then check to see what tab was clicked.

Mike Shane
MST Associates

"David Rose" <da***@silverswitch.net> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Nicholas,

Thanks. That works fine.

I was hoping that there would be an easier way, but I guess that for some
reason that event is not handled in .NET.

David
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OK**************@TK2MSFTNGP09.phx.gbl...
David,

You should be able to hook into the windows procedure of the
parent of the tab control and catch that notification. You just have to

override the
WndProc method on that container.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"David Rose" <da***@silverswitch.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> I would like to catch the tab change before it occurs. There is a
> SelectedIndexChanged event to catch the change after it occurs. How

do
I
> catch when the user clicks on a tab, but before the TabPage changes?
>
> Is there anything like the TCN_SELCHANGING notification?
>
> TIA
>
> David Rose
>
>
>



Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paiam Salavati | last post by:
I want to change the the color of the tabs and the color of TabControl itself in a TabControl. Therefore I wrote the following code in my customized TabControl-class: this.DrawMode =...
2
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a...
5
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould...
3
by: cdj | last post by:
Hi all, I've got a tabControl, initially with one tabPage, along with two buttons, one to add another tabPage, and one to delete the current (selected) tabPage. On each tabPage, when it is...
1
by: Keith Smith | last post by:
How do I change the colors of a tabControl (including the tabs themselves). I only see the option to change the color of each tabPage.
9
by: Michael Turner | last post by:
Hi Guys Having problem with the tab control, I need to set the background color to something different than the standard, I have found code on the web and now can redraw the tabpage buttons so...
1
by: HS1 | last post by:
Hello I can change the background of each page of a TabControl but cannot change the background (BackColor) of this tabcontrol. I did not see it in the properties page. If you know how to...
0
by: =?Utf-8?B?TWFydGluIw==?= | last post by:
Hello everybody! Please note that I have posted same question in different forums with no success. So If you tried to help me there, please do not consider the repost as rude! I'm working on...
1
by: dhmore | last post by:
Hi friends i have tried to much to change the TabControl's Font and back color but i cann,t can u help to change it in VB.Net
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.