vb 控件组该怎么添加
发布网友
发布时间:2022-04-23 04:36
我来回答
共3个回答
热心网友
时间:2023-07-09 18:59
添加mshflexgrid控件的办法如下:
要程序的代码是:dim
i,
j,
k
as
integer
1、设置行列数
with
mshflexgrid1
.rows
=
5
.cols
=
5
end
with
2、添加表头
mshflexgrid1.row
=
0
for
i
=
1
to
mshflexgrid1.cols
-
1
mshflexgrid1.col
=
i
mshflexgrid1.text
=
"列"
&
i
next
3、添加记录
k
=
1
for
i
=
1
to
mshflexgrid1.rows
-
1
for
j
=
1
to
mshflexgrid1.cols
-
1
mshflexgrid1.row
=
i
mshflexgrid1.col
=
j
mshflexgrid1.text
=
k
k
=
k
+
1
next
next
说明:添加部件"microsoft
hierarchical
flexgrid
control
6.0
(oledb)"才能使用mshflexgrid.
热心网友
时间:2023-07-09 19:00
Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Dim i As Integer
Dim wsk As Winsock
i = Winsock1.UBound
If i < 32767 Then
For i = 1 To Winsock1.UBound + 1
On Error Resume Next
If Winsock1(i).state = 11 Then '如果winsock1(i)存在就跳过了下面内容,不存在就ERROR执行If的内容。
Load Winsock1(i)
Set wsk = Winsock1(i)
With wsk
.LocalPort = 14310 '不需要修改端口。
End With
Set wsk = Nothing
Winsock1(i).Accept requestID
exit for
End If
Next i
End If
End Sub
循环从1 到 Winsock1.UBound+1这样执行到最后就必然会产生错误,也就必然会LOAD控件了.注意你要定时检测断开的控件并将它们UNLOAD,不然的话会很麻烦的! 开始的代码有点错误现在应该正确了!
热心网友
时间:2023-07-09 19:00
所需要的控件就2个,应该没必要用控件数组,就添加两个Winsock,使用代码分配控件来协调工作就行了,如果需要控件数组,请参考http://zhidao.baidu.com/question/5282762.html?si=1