Results 1 to 10 of 10

Thread: How To Debug This?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    71

    How To Debug This?

    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.

    Any thoughts on how I can debug this?

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    71
    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.

    So what could possibly do this?

    G

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Shrug, zip your project and post it and let me take a look.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    71
    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.
    Attached Files Attached Files

  6. #6
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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
    \m/\m/

  7. #7
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    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)

  8. #8
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    This works:

    VB Code:
    1. Private Sub TopicDeleteMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TopicDeleteMenuItem.Click
    2.         If SmartPadTabControl.TabCount > 1 And SmartPadTabControl.SelectedIndex > 0 Then
    3.             Me.SmartPadTabControl.SelectedTab.Select()
    4.             Me.SmartPadTabControl.TabPages.Remove(SmartPadTabControl.SelectedTab)
    5.             Me.SmartPadTabControl.SelectedIndex = 0
    6.         End If
    7.    End Sub

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    71
    That does it! Thanks for taking the time. I searched around for a related bug report, but so far have not found it.

  10. #10
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    we had a similar problem and overcame it by reseting the focus. see this for details.

    http://www.devcity.net/forums/topic.asp?tid=2631&page=2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width