重复按command4不会出错,但一选combol就出错,这是怎么回事呢。。如何改正,谢谢代码如下:
把它保存成一个.frm的文件VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5850
ClientLeft = 60
ClientTop = 345
ClientWidth = 7860
LinkTopic = "Form1"
ScaleHeight = 5850
ScaleWidth = 7860
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command4
Caption = "Command4"
Height = 615
Left = 3240
TabIndex = 4
Top = 1680
Width = 2535
End
Begin VB.CommandButton Command5
Caption = "Command5"
Height = 615
Left = 3240
TabIndex = 3
Top = 960
Width = 2535
End
Begin VB.CheckBox chkSet
Caption = "Check3"
Height = 255
Index = 0
Left = 480
TabIndex = 2
Top = 600
Width = 3975
End
Begin VB.CheckBox chkSelect
Caption = "选择/返选"
Height = 255
Index = 0
Left = 480
TabIndex = 1
Top = 120
Width = 4095
End
Begin VB.ComboBox Combo1
Height = 315
ItemData = "Form1.frx":0000
Left = 3360
List = "Form1.frx":000D
TabIndex = 0
Text = "Combo1"
Top = 2520
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim iRow As IntegerPrivate Sub Combo1_Click()
Command4_ClickEnd SubPrivate Sub Command4_Click()
Dim i As Integer
Command5_Click
iRow = iRow - 1
For i = 1 To iRow
Load chkSet(i)
chkSet(i).Top = chkSet(i - 1).Top + 200
chkSet(i).Caption = i
chkSet(i).Visible = True
NextEnd SubPrivate Sub Command5_Click()
Dim i As Integer
On Error Resume Next
chkSet(0).Visible = False
For i = chkSet.Count - 1 To 1 Step -1
Unload chkSet(i)
Next
For i = chkSelect.Count - 1 To 1 Step -1
Unload chkSelect(i)
Next
End SubPrivate Sub Form_Load()
iRow = 20
End Sub
把它保存成一个.frm的文件VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5850
ClientLeft = 60
ClientTop = 345
ClientWidth = 7860
LinkTopic = "Form1"
ScaleHeight = 5850
ScaleWidth = 7860
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command4
Caption = "Command4"
Height = 615
Left = 3240
TabIndex = 4
Top = 1680
Width = 2535
End
Begin VB.CommandButton Command5
Caption = "Command5"
Height = 615
Left = 3240
TabIndex = 3
Top = 960
Width = 2535
End
Begin VB.CheckBox chkSet
Caption = "Check3"
Height = 255
Index = 0
Left = 480
TabIndex = 2
Top = 600
Width = 3975
End
Begin VB.CheckBox chkSelect
Caption = "选择/返选"
Height = 255
Index = 0
Left = 480
TabIndex = 1
Top = 120
Width = 4095
End
Begin VB.ComboBox Combo1
Height = 315
ItemData = "Form1.frx":0000
Left = 3360
List = "Form1.frx":000D
TabIndex = 0
Text = "Combo1"
Top = 2520
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim iRow As IntegerPrivate Sub Combo1_Click()
Command4_ClickEnd SubPrivate Sub Command4_Click()
Dim i As Integer
Command5_Click
iRow = iRow - 1
For i = 1 To iRow
Load chkSet(i)
chkSet(i).Top = chkSet(i - 1).Top + 200
chkSet(i).Caption = i
chkSet(i).Visible = True
NextEnd SubPrivate Sub Command5_Click()
Dim i As Integer
On Error Resume Next
chkSet(0).Visible = False
For i = chkSet.Count - 1 To 1 Step -1
Unload chkSet(i)
Next
For i = chkSelect.Count - 1 To 1 Step -1
Unload chkSelect(i)
Next
End SubPrivate Sub Form_Load()
iRow = 20
End Sub
Call Command4_Click
End Sub
你的不会出错??
不可能吧。
你点combo1这里啊,选一个下拉列表就出错了
按一下Combo1
会不出错?????????????????
'On Error Resume Next 注释掉不能在该上下文中卸载(错误 365)某些情况下,不允许卸载窗体或窗体中的控件。此错误产生的原因及解决方法如下: 在 ComboBox.的 Change、Click 或 DropDown 事件中有一个 Unload 语句。
从事件中删除 Unload 语句。
http://community.csdn.net/Expert/topic/4587/4587750.xml?temp=.5593378
在 ComboBox.的 Change、Click 或 DropDown 事件中有一个 Unload 语句。
从事件中删除 Unload 语句。
interval=1, enable=falsePrivate Sub Combo1_Click()
Timer1.Enabled = True
End SubPrivate Sub Timer1_Timer()
Timer1.Enabled = False
Command4_Click
End Sub
**********************************
*本人主要使用VB+MS SQL,C#略知一二*
* *
*如有相关问题需要帮助 *
* *
*可发短消息告知链接 *
**********************************