Form.Hide() is not hiding the form!

I'm developing in VS.NET 2003 on WindowsXP Pro.

I'm seeing a strange intermittent bug where I will hide a form (using Me.Hide()), and the form remains visible. Debugging the form shows that the form properties are being set correctly (Me.Visible = False, yet the form is still visible!). This behavior happens on XP, and not on win2k.

I've been able to duplicate this issue in the debugger (on XP) by setting a breakpoint on the Me.Hide() line.

When the breakpoint is hit:

1) Focus on the window to be hidden
2) Drag the window to be hidden a short distance
3) Step to the next line of code in the debugger (executing Me.Hide())
4) Watch in amazement as the window does not hide (even though Me.Visible = false).

Any idea what I can do to make sure that a window hides when it's supposed to hide? I can't destroy this window, as there are ActiveX controls that are required by my main application.

Mike

Comments

  • same thing happened to me once.. what i did was i went forward in debug mode all the way till the end..
    turns out, there were some unresolved small errors and some uninitializes stuff after i removed all the SMALL ERRORS and made all my CODE RIGHT, i ran it again and it worked!
    what about u?
    mamanged to get it to work yet?

    [size=1][COLOR=blue]"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."[i]1Thess. 5:16-18[/i][/color][/size]

  • It's possible that when you break at that line the paint event is not being triggered. Without seeing your code (why does no one show there's?!?) I would try:

    With Me
    Hide()
    Invalidate()
    Update()
    DoEvents()
    End With

    : I'm developing in VS.NET 2003 on WindowsXP Pro.
    :
    : I'm seeing a strange intermittent bug where I will hide a form (using Me.Hide()), and the form remains visible. Debugging the form shows that the form properties are being set correctly (Me.Visible = False, yet the form is still visible!). This behavior happens on XP, and not on win2k.
    :
    : I've been able to duplicate this issue in the debugger (on XP) by setting a breakpoint on the Me.Hide() line.
    :
    : When the breakpoint is hit:
    :
    : 1) Focus on the window to be hidden
    : 2) Drag the window to be hidden a short distance
    : 3) Step to the next line of code in the debugger (executing Me.Hide())
    : 4) Watch in amazement as the window does not hide (even though Me.Visible = false).
    :
    : Any idea what I can do to make sure that a window hides when it's supposed to hide? I can't destroy this window, as there are ActiveX controls that are required by my main application.
    :
    : Mike
    :

  • I've never been able to solve the problem, so as a work-around, I enabled the control box (minimize/maximize/close) and trapped the Close event to minimize the form instead.

    I'm certain that this is a bug in the .NET Framework 1.1, perhaps having something to do with COM interop (I have non-visible ActiveX components on the form in question). It happens randomly on Windows XP and not on Windows 2000.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories