Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

[RESOLVED] Unloading a form from popupmenu that is on another form.

$
0
0
There are two forms. The first one, let's call it form1 is a simple form. The second one, form2, is a hidden one with a menu on it.
When you right-click on the form1, it calls a popupmenu from form2
In the popupmenu that is located in form2, there is a menu "Unload this form".
There also is a module with code:
Code:

Public formFrom as string
The code for showing up the popupmenu when you right click in the form1 is like this:
Code:

Private Sub Form1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
Me.PopupMenu form2.menu
formFrom =  me.name
Else
End If
End Sub

The code in the "Unload" menu on the form2 is like this:
Code:

Private Sub unload_Click()
Unload formFrom
End Sub

This doesn't work. How can I solve it? Thanks in advance.

Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>