ALX
Well-known member
I know I'll get chastised for my method here, but that is precisely why I come to this forum. I appreciate being corrected and I can't think of another way to do this ...
One form initiates another small form that is a very small window on top of the main form and is used as a very transient legend. The intention is for this legend to go away with ANY Keydown, Mouse Click or loss of Focus that occurs, whether it's focused on the legend OR the underlying form or any other way that the legend might lose focus. When I show the legend as a modal form, it doesn't lose focus when I click on the underlying form. The way I get this to work is by showing the Legend as a non-modal form, as in the following:
Then in the Legend's Closing Sub, I include this:
My question is: The variable "F" in the original calling procedure is never Disposed. I thought I was covering my bases by Disposing KeyboardShortCuts in it's own Closing Sub. Is it possible that "F" is still floating out there in memory as an active variable even tho I've Disposed the Form that it refers to...?
One form initiates another small form that is a very small window on top of the main form and is used as a very transient legend. The intention is for this legend to go away with ANY Keydown, Mouse Click or loss of Focus that occurs, whether it's focused on the legend OR the underlying form or any other way that the legend might lose focus. When I show the legend as a modal form, it doesn't lose focus when I click on the underlying form. The way I get this to work is by showing the Legend as a non-modal form, as in the following:
VB.NET:
Dim F As New KeyboardShortCuts
' Any code here for setup...
F.Show()
Then in the Legend's Closing Sub, I include this:
VB.NET:
Private Sub KeyboardShortCuts_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If Not Me.Disposing Then Me.Dispose()
End Sub
My question is: The variable "F" in the original calling procedure is never Disposed. I thought I was covering my bases by Disposing KeyboardShortCuts in it's own Closing Sub. Is it possible that "F" is still floating out there in memory as an active variable even tho I've Disposed the Form that it refers to...?
Last edited: