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

[RESOLVED] Why does this code unload my whole project?

$
0
0
There are two forms. The first one(form1) has a command button. When you click it, it calls the second form(form2) using this code:
Code:

form2.show
In form2 there are two picture boxes. The first one(pic1) is visible, the second(pic2) is not. When the mouse hovers pic1:
Code:

Private Sub pic1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
SetCursor LoadCursor(0, IDC_HAND)
End Sub

Code:

Private Sub pic1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
pic1.Visible = True
pic2.Visible = False
unload me
End Sub

Code:

Private Sub pic1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
pic1.Visible = False
pic2.Visible = True
End Sub

This will give the feeling of a hover effect, using two pictures.
But when I test it, the whole project unloads.
Why does this happen? How can it be solve? Thanks.

Viewing all articles
Browse latest Browse all 21251

Trending Articles



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