TabPage Events do not fire w/ .Net1.1
-
Hello i have a simple windows form with a TabControl and several TabPages. I've added Event Handlers for the TabPage's Enter/Leave/Validating events. The Events never fire! The same code build with VS2005 works! How can i get the Events to work with VS2003 and .Net 1.1:confused:? Michael
-
Hello i have a simple windows form with a TabControl and several TabPages. I've added Event Handlers for the TabPage's Enter/Leave/Validating events. The Events never fire! The same code build with VS2005 works! How can i get the Events to work with VS2003 and .Net 1.1:confused:? Michael
You have to be aware that VS 2005 differs a lot from the old ones. Unlike the VS2003 and .Net 1.1 that are much similar to each other. In VS2005 many of the namespaces have changed and many were combined with some other and many new where added.U can't expect for the same coding to work for VS2005 and VS2003. Maybe this is not the case. Maybe you are not fire the events. If you are just copy and pate the source code then you wouldn't be initalizing the events. You should go to each tab seperatly and fire the events. Hope it will benefit you. Jamil abou khalil
-
You have to be aware that VS 2005 differs a lot from the old ones. Unlike the VS2003 and .Net 1.1 that are much similar to each other. In VS2005 many of the namespaces have changed and many were combined with some other and many new where added.U can't expect for the same coding to work for VS2005 and VS2003. Maybe this is not the case. Maybe you are not fire the events. If you are just copy and pate the source code then you wouldn't be initalizing the events. You should go to each tab seperatly and fire the events. Hope it will benefit you. Jamil abou khalil
Thanks but that does not help me:( I simply created a new C# windows app, dragged a TabControl from the Toolbox and added two Tabpages. Then I made to following changes to the resulting code: public Form1 () { InitializeComponent (); this.tabPage1.Leave += new EventHandler ( tabPage1_Leave ); this.tabPage1.Enter += new EventHandler ( tabPage1_Enter ); } void tabPage1_Enter ( object sender, EventArgs e ) { Debug.WriteLine ( "tabPage1_Enter" ); } void tabPage1_Leave ( object sender, EventArgs e ) { Debug.WriteLine ( "tabPage1_Leave" ); } I expect the Events to fire when the user selects a tabpage. That does not happen. The same code imported with VS2005 works! What can I do? Michael
-
Thanks but that does not help me:( I simply created a new C# windows app, dragged a TabControl from the Toolbox and added two Tabpages. Then I made to following changes to the resulting code: public Form1 () { InitializeComponent (); this.tabPage1.Leave += new EventHandler ( tabPage1_Leave ); this.tabPage1.Enter += new EventHandler ( tabPage1_Enter ); } void tabPage1_Enter ( object sender, EventArgs e ) { Debug.WriteLine ( "tabPage1_Enter" ); } void tabPage1_Leave ( object sender, EventArgs e ) { Debug.WriteLine ( "tabPage1_Leave" ); } I expect the Events to fire when the user selects a tabpage. That does not happen. The same code imported with VS2005 works! What can I do? Michael
Hi, i don't know when those events are fired (they are not the same as MouseLeave and MouseEnter) but if you want to fire an event when switching/selecting another tabpage you could use the TabControls "TabIndexChanged" event. Make sure you REALLY fire the events. (maybe try mouseenter and mouseleave instead just to make sure that it works at all!)
-
Hi, i don't know when those events are fired (they are not the same as MouseLeave and MouseEnter) but if you want to fire an event when switching/selecting another tabpage you could use the TabControls "TabIndexChanged" event. Make sure you REALLY fire the events. (maybe try mouseenter and mouseleave instead just to make sure that it works at all!)
mikone wrote:
TabControls "TabIndexChanged" event.
The problem here is that the event is raised after the new tab is drawn. I can reactivate the previous page but then i see the page flicker. What i want to do is prevent the page change. My current solution is to override the OnSelectedIndexChanged(EventArgs e) method. But that looks awfully cumbersome given the fact that I should be able to page enter / page leave events. Only it does not work because there is a bug in .Net 1.1 that has been fixed in version 2.0 Cheers Michael