Form1没unload Private Sub end_Click() RemoveTray '调用过程删除托盘图标 Unload TheForm '卸载窗体 Unload Form2 '卸载窗体 Unload Form3 '卸载窗体 Unload Form1 '卸载窗体 Set TheForm = Nothing Set TheMenu = Nothing End End Sub
格式化一下你的代码 这样便于发现问题Option ExplicitPrivate Type RECT Left As Long Top As Long Right As Long Bottom As Long End TypePrivate Const LVM_FIRST = &H1000 Private Const LVM_GETITEMRECT = (LVM_FIRST + 14) Private Const LVM_GETSUBITEMRECT = (LVM_FIRST + 56) Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function SkinH_Attach Lib "SkinH_VB6.dll" () As LongPrivate Sub Form_Load() Dim i As Long SkinH_Attach Set TheForm = Me '窗体 Set TheMenu = textmenu '菜单名称 SetTray '调用过程显示托盘图标 Minimized '调用过程最小化隐藏窗体,效果为最小化到托盘 textmenu.Visible = False Command3.Visible = False Label6.Visible = False End SubPrivate Sub Command1_Click() Dim zs As Double zs = GetINI("\config.ini", "参数", "百分比", 0) Dim a As Double Dim z As Double
If Text1.Text = "" Or Text2.Text = "" Then MsgBox "不能为空!", vbOKOnly + 64, "系统提示!" ElseIf IsNumeric(Text1.Text) = False Or IsNumeric(Text2.Text) = False Then MsgBox "请输入数值!", vbOKOnly + 64, "系统提示!" Else a = Trim(Text1.Text) z = a / (1 + zs) * zs z = Format(z, "0.00") Label2.Visible = False Label3.Visible = False Text1.Visible = False Text2.Visible = False Command1.Visible = False Command2.Visible = False Cls Print Print Print Print Print Print Print Label6.Caption = "计算结果为:" & z & "元" Print Label6.Visible = True Command3.Visible = True End If
End SubPrivate Sub Command2_Click() Text1.Text = "" Text1.SetFocus End SubPrivate Sub Command3_Click() Cls Label6.Visible = False Label2.Visible = True Label3.Visible = True Text1.Visible = True Text2.Visible = True Command1.Visible = True Command2.Visible = True Command3.Visible = False Text1.Text = "" Text1.SetFocus End SubPrivate Sub gy_Click() Form3.Show End SubPrivate Sub set1_Click() Form2.Show End SubPrivate Sub Form_Unload(Cancel As Integer) Cancel = True 'Cancel是删去,取消的意思 Form1.Hide End SubPrivate Sub end_Click() RemoveTray '调用过程删除托盘图标 Unload TheForm '卸载窗体 Unload Form2 '卸载窗体 Unload Form3 '卸载窗体 Set TheForm = Nothing Set TheMenu = Nothing
End End Sub
Private Sub Form_Unload(Cancel As Integer) End End Sub
Private Sub end_Click()
RemoveTray '调用过程删除托盘图标
Unload TheForm '卸载窗体
Unload Form2 '卸载窗体
Unload Form3 '卸载窗体
Unload Form1 '卸载窗体
Set TheForm = Nothing
Set TheMenu = Nothing
End
End Sub
这样便于发现问题Option ExplicitPrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate Const LVM_FIRST = &H1000
Private Const LVM_GETITEMRECT = (LVM_FIRST + 14)
Private Const LVM_GETSUBITEMRECT = (LVM_FIRST + 56)
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SkinH_Attach Lib "SkinH_VB6.dll" () As LongPrivate Sub Form_Load()
Dim i As Long
SkinH_Attach
Set TheForm = Me '窗体
Set TheMenu = textmenu '菜单名称
SetTray '调用过程显示托盘图标
Minimized '调用过程最小化隐藏窗体,效果为最小化到托盘
textmenu.Visible = False
Command3.Visible = False
Label6.Visible = False
End SubPrivate Sub Command1_Click()
Dim zs As Double
zs = GetINI("\config.ini", "参数", "百分比", 0)
Dim a As Double
Dim z As Double
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "不能为空!", vbOKOnly + 64, "系统提示!"
ElseIf IsNumeric(Text1.Text) = False Or IsNumeric(Text2.Text) = False Then
MsgBox "请输入数值!", vbOKOnly + 64, "系统提示!"
Else
a = Trim(Text1.Text)
z = a / (1 + zs) * zs
z = Format(z, "0.00")
Label2.Visible = False
Label3.Visible = False
Text1.Visible = False
Text2.Visible = False
Command1.Visible = False
Command2.Visible = False
Cls
Print
Print
Print
Print
Print
Print
Print
Label6.Caption = "计算结果为:" & z & "元"
Print
Label6.Visible = True
Command3.Visible = True
End If
End SubPrivate Sub Command2_Click()
Text1.Text = ""
Text1.SetFocus
End SubPrivate Sub Command3_Click()
Cls
Label6.Visible = False
Label2.Visible = True
Label3.Visible = True
Text1.Visible = True
Text2.Visible = True
Command1.Visible = True
Command2.Visible = True
Command3.Visible = False
Text1.Text = ""
Text1.SetFocus
End SubPrivate Sub gy_Click()
Form3.Show
End SubPrivate Sub set1_Click()
Form2.Show
End SubPrivate Sub Form_Unload(Cancel As Integer)
Cancel = True 'Cancel是删去,取消的意思
Form1.Hide
End SubPrivate Sub end_Click()
RemoveTray '调用过程删除托盘图标
Unload TheForm '卸载窗体
Unload Form2 '卸载窗体
Unload Form3 '卸载窗体
Set TheForm = Nothing
Set TheMenu = Nothing
End
End Sub
End
End Sub