VB统计次数
答案:1 悬赏:30 手机版
解决时间 2021-11-11 06:39
- 提问者网友:骨子里的高雅
- 2021-11-10 10:13
VB统计次数
最佳答案
- 五星知识达人网友:上分大魔王
- 2021-11-10 10:54
Private Sub Form_click()
Dim a As Variant, b(32) As String, c() As Integer, d() As String
Dim i As Long, j As Long
a = Split(Text1.Text, " ")
For i = 0 To 32
b(i) = Format(i + 1, "00")
Next
ReDim c(UBound(b))
For i = 0 To UBound(b)
For j = 0 To UBound(a)
If b(i) = a(j) Then c(i) = c(i) + 1
Next
Next
ReDim Preserve d(x) As String
For i = 0 To UBound(c)
If c(i) > UBound(d) Then ReDim Preserve d(c(i)) As String
d(c(i)) = d(c(i)) & b(i) & " "
Next
Cls
For i = 0 To UBound(d)
Print d(i) & " 出现" & i & "次"
Next
End Sub
Private Sub Form_Load()
Text1.Text = "02 05 06 12 14 28 04 06 12 30 31 32 02 08 13 28 29 30 01 02 05 16 20 26 01 07 08 12 16 21"
End Sub
Dim a As Variant, b(32) As String, c() As Integer, d() As String
Dim i As Long, j As Long
a = Split(Text1.Text, " ")
For i = 0 To 32
b(i) = Format(i + 1, "00")
Next
ReDim c(UBound(b))
For i = 0 To UBound(b)
For j = 0 To UBound(a)
If b(i) = a(j) Then c(i) = c(i) + 1
Next
Next
ReDim Preserve d(x) As String
For i = 0 To UBound(c)
If c(i) > UBound(d) Then ReDim Preserve d(c(i)) As String
d(c(i)) = d(c(i)) & b(i) & " "
Next
Cls
For i = 0 To UBound(d)
Print d(i) & " 出现" & i & "次"
Next
End Sub
Private Sub Form_Load()
Text1.Text = "02 05 06 12 14 28 04 06 12 30 31 32 02 08 13 28 29 30 01 02 05 16 20 26 01 07 08 12 16 21"
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯