471,339 Members | 1,242 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

TabControl - Suppress Event on Load


Dear Group

Just wondered whether you have any advice on the following?

I have a form with a TabControl and when the form loads, the
SelectedIndexChanged event is fired. Is there any chance to suppress
this event when the form loads but enable it once the form has finished
loading?

I'm very grateful for any hints as I've wasted two days so far on
finding a solution.

Many thanks for your time and efforts!
Have a nice day!

Martin

Jul 22 '05 #1
2 1977
remove the 'Handles MyTabControl.SelectedIndexChanged' from the end of the
sub and add

AddHandler MyTabControl.SelectedIndexChanged, AddressOf
MyTabControl_SelectedIndexChanged

to Form_Load()

or alternatively, add a Static flag to the event so that it ignores the
first change.

\\\
Sub MyTabControl_SelectedIndexChanged(...) Handles ...
Static FirstChange As Boolean = False
If FirstChange = False then
FirstChange = True
Return
End If
'Your code here
End Sub
///

This does not happen in C# because the handler is added in the Forms
InitializeComponent Method.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
<th************@hotmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...

Dear Group

Just wondered whether you have any advice on the following?

I have a form with a TabControl and when the form loads, the
SelectedIndexChanged event is fired. Is there any chance to suppress
this event when the form loads but enable it once the form has finished
loading?

I'm very grateful for any hints as I've wasted two days so far on
finding a solution.

Many thanks for your time and efforts!
Have a nice day!

Martin

Jul 22 '05 #2
Thanks so much Nick! That's great!

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tamir Khason | last post: by
1 post views Thread by amber | last post: by
9 posts views Thread by Michael Turner | last post: by
2 posts views Thread by theintrepidfox | last post: by
2 posts views Thread by Simon Verona | last post: by
2 posts views Thread by =?Utf-8?B?TW9oc2luIEtoYW4=?= | last post: by

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.