Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

TabControl.SelectedIndexChanged event?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nad - 18 Apr 2005 22:37 GMT
Hello,

The SelectedIndexChanged event of TabControl object occurs when a tabpage is
selected.

I need to do some processing when user selects a new tabpage but before the
SelectedIndex has changed to the newly set tabpage index. I would call such
an event SelectedIndexChanging which would be raised before
SelectedIndexChanged.

Is there such an event? Or a solution to my need?

Thanks in advance.
Claudio Grazioli - 19 Apr 2005 07:59 GMT
No, there is no such event.

But you could store the current Index. When the SelectedIndexChanged event
is fired you still know the old index because you saved it before. You can
then do your processing with the old index, store the new Index and go on.

hth
Signature

Claudio Grazioli
http://www.grazioli.ch
http://www.grazioli.ch/HommingbergerGepardenforelle/

Nad - 19 Apr 2005 16:16 GMT
Thanks Claudio,

Let's say SelectedIndexChanged is fired and if some condition is not met you
don't want to change the tabpage and want to go back to the old one. So you
need to set the SelectedIndex to the old index in which case the
SelectedIndexChanged is fired again and I don't have a neat solution to get
around that event being fired the second time.

> No, there is no such event.
>
[quoted text clipped - 3 lines]
>
> hth
Claudio Grazioli - 19 Apr 2005 17:46 GMT
> Thanks Claudio,
>
[quoted text clipped - 3 lines]
> SelectedIndexChanged is fired again and I don't have a neat solution to get
> around that event being fired the second time.

ok. that's not an easy one. at least I don't have a solution.

Some thoughts:
- Why do you let the user select an other tabpage at
 all when this certain conditions are not?
 I don't know what the conditions are, but I assume it
 has to do with valid values in the controls of the
 current TabPage. If so, if you use something like
 validation, the user could not select another TabPage
 as long as there are invalid values on the current
 TabPage.
 You could also hide the other TabPages as long as
 not all values are valid.

just ideas...

Cheers
Signature

Claudio Grazioli
http://www.grazioli.ch
http://www.grazioli.ch/HommingbergerGepardenforelle/

Mick Doherty - 19 Apr 2005 08:49 GMT
http://dotnetrix.co.uk/tabcontrols.html --> Add SelectedIndexChanging Event

Signature

Mick Doherty
http://dotnetrix.co.uk/nothing.html

> Hello,
>
[quoted text clipped - 12 lines]
>
> Thanks in advance.
Nad - 19 Apr 2005 15:09 GMT
Thank you Mick. Nice tips you've got on your site!

> http://dotnetrix.co.uk/tabcontrols.html --> Add SelectedIndexChanging Event
>
[quoted text clipped - 14 lines]
> >
> > Thanks in advance.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.