VB里面,我要动态加载控件,我在form里面放了这个控件,我设他的index为0,然后,我在程序里面去动态加.下面是我的程序
Private Sub Command1_Click()
Load mvlc(1)
Load mvlc(2)
With mvlc(1)
.Visible = True
.Top = 0
.Left = 0
End With
With mvlc(2)
.Visible = True
.Top = mvlc(1).Height
.Left = 0
End WithEnd SubPrivate Sub Command2_Click()
Unload mvlc(2)
Unload mvlc(1)
End Sub
第一次点command1加载成功以后,再点command2成功卸载,但以后点command1就会程序无响应.
但我如果一次加载四个以上,再卸载就不会有问题,即如下程序:
Private Sub Command1_Click()
Load mvlc(1)
Load mvlc(2)
Load mvlc(3)
Load mvlc(4)
With mvlc(1)
.Visible = True
.Top = 0
.Left = 0
End With
With mvlc(2)
.Visible = True
.Top = mvlc(1).Height
.Left = 0
End With
With mvlc(3)
.Visible = True
.Top = mvlc(1).Height + mvlc(2).Height
.Left = 0
End With
With mvlc(4)
.Visible = True
.Top = 0
.Left = mvlc(1).Width
End With
End SubPrivate Sub Command2_Click()
Unload mvlc(4)
Unload mvlc(3)
Unload mvlc(2)
Unload mvlc(1)
End Sub
这是为什么,请大家帮一下忙,我使的控件就是那个VLC控件
Private Sub Command1_Click()
Load mvlc(1)
Load mvlc(2)
With mvlc(1)
.Visible = True
.Top = 0
.Left = 0
End With
With mvlc(2)
.Visible = True
.Top = mvlc(1).Height
.Left = 0
End WithEnd SubPrivate Sub Command2_Click()
Unload mvlc(2)
Unload mvlc(1)
End Sub
第一次点command1加载成功以后,再点command2成功卸载,但以后点command1就会程序无响应.
但我如果一次加载四个以上,再卸载就不会有问题,即如下程序:
Private Sub Command1_Click()
Load mvlc(1)
Load mvlc(2)
Load mvlc(3)
Load mvlc(4)
With mvlc(1)
.Visible = True
.Top = 0
.Left = 0
End With
With mvlc(2)
.Visible = True
.Top = mvlc(1).Height
.Left = 0
End With
With mvlc(3)
.Visible = True
.Top = mvlc(1).Height + mvlc(2).Height
.Left = 0
End With
With mvlc(4)
.Visible = True
.Top = 0
.Left = mvlc(1).Width
End With
End SubPrivate Sub Command2_Click()
Unload mvlc(4)
Unload mvlc(3)
Unload mvlc(2)
Unload mvlc(1)
End Sub
这是为什么,请大家帮一下忙,我使的控件就是那个VLC控件
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货