VB: 如何在模式窗口下对另外的窗口的控件属性进行更改?
我有个main窗口,里面有个newfile按钮控件,当点击它的时候,弹出新窗口winnew:
Private Sub newfile_Click()
winnew.Show vbModal
newfile.Enabled = False
end sub
在winnew里有个 " confirm " 和 " cancel " 按钮.我想在点取消的时候,把newfile按钮的属性改成true,然后关闭winnew窗口
Private Sub cancel_Click()
main.newfile.Enabled = True
Unload Me
End Sub
问题是点cancel按钮后,winnew窗口关闭了,newfile属性值却不改变。请求如何做?我的目的是1.让winnew窗口的焦点锁定,直到响应它2.点cancel后能改变newfile的属性。
VB初学者,希望各位大牛提携提携!
[解决办法]
Private Sub newfile_Click()
Dim winnew1 As New winnew
winnew1.Show vbModal
If winnew1.Cancel Then newfile.Enabled = False
Unload winnew1
Set winnew1 = Nothing
End Sub
'在winnew里定义一个 Public 变量 Cancel as boolean
Public Cancel As Boolean
Private Sub cancel_Click()
Cancel = True
Me.Hide
End Sub
[解决办法]
定一个public函数