I am working on a little application that allows adding and deleting pages to a TabControl at runtime.
When you select Delete Page I do this:
Me.SmartPadTabControl.TabPages.Remove(SmartPadTabControl.SelectedTab)
Seems to work fine, but after deleting the page, I cannot close the application by closing the window??? I put a line of code in the MyBase.Closing Event handler and set a breakpoint there, but when I try to close the window we never enter that event code at all.
Yet, all other program functions work, so I'm not stuck in a loop somewhere,e tc.
The window closes fine as long as I dont select the Delete Tab menu option. Once I do select the Delete Tab operation, the only way to get out of the application is to select Debug/Stop Debugging from the VS menu.
On my machine it works fine, the app closes normally. Why don't you walk through the menu event in the debugger and see if you can spot anything suspicious? Or post your code here.
Stepping through the menu events is no help becuase the problem is with the Red X in the Control Box. When I press the Red X before deleting a tab, the application closes. When I press the Red X after deleting a tab, it is ignored.
I placed code in the Form Closing event figuring that I could trap the problem there, but that event is never triggered.
Thanks. It's my get acquainted with VB program, so its not much and its not done.
When it asks you to select a file, press Cancel and you will get a one tab tabcontrol. Then select Topic/Add and enter a topic name. Then select Topic/Delete and delete the new topic. Then try to close the application. The only way out will be through the File menu.
the problem you have is a .NET bug.
search for the forum for the site which have the listed bugs and work-arounds or maybe when i have more time i'll look it for you
Seems like the problem is caused by the textbox inside the tabpage having the focus. When the textbox is focused, your problem appears (form won't close with X button or Control Menu -> Close) - but when the textbox does NOT have focus (click on the tabpage after I commented out your Textbox.Focus) then the problem does not arise. I think if you move focus away from the textbox you can avoid this problem (trying it myself)