求助 VB

txlk33 2008-09-24 09:32:03


01,02,03,04
05,08,09,12
04,05,13,15
02,04,09,10

怎样读取行与行之间的指定数据之间的间隔呢

...全文
174 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jhone99 2008-09-24
  • 打赏
  • 举报
回复
Private Sub Command1_Click()


Dim i As Integer
Dim j As Integer
Dim strT As String
Dim intS As Integer

strT = "02"

With MSFlexGrid1

For i = 1 To .Rows - 1
.Row = i
.Col = 3
For j = 1 To Len(.Text) - 1

If Mid(.Text, j, 2) = strT Then
If intS > 0 Then
Print i - intS - 1
End If
intS = i
End If
Next j
Next i

End With
End Sub
jhone99 2008-09-24
  • 打赏
  • 举报
回复
Private Sub Command1_Click()


Dim i As Integer
Dim j As Integer
Dim strT As String
Dim intS As Integer

strT = "02"

With MSFlexGrid1

For i = 1 To 4
.Row = i
.Col = 3
For j = 1 To Len(.Text) - 1

If Mid(.Text, j, 2) = strT Then
If intS > 0 Then
Print i - intS - 1
End If
intS = i
End If
Next j
Next i

End With
End Sub

jhone99 2008-09-24
  • 打赏
  • 举报
回复
Private Sub Command1_Click()


Dim a() As String
Dim i As Integer
Dim j As Integer
Dim strT As String
Dim intS As Integer


a = Split("01,02,03,04,05,08,09,12,04,05,13,15,02,04,09,10", ",")
strT = "02"

With MSFlexGrid1
.Rows = 5
.Cols = 5

For i = 1 To 4
For j = 1 To 4
.Row = i
.Col = j
.Text = a((i - 1) * 4 + j - 1)
Next j
Next i

For i = 1 To 4
For j = 1 To 4
.Row = i
.Col = j

If .Text = strT Then
If intS > 0 Then
Print i - intS - 1
End If
intS = i
End If
Next j
Next i

End With
End Sub
txlk33 2008-09-24
  • 打赏
  • 举报
回复

如, 查找所有02与02之间的间隔读取问题了 。不明白发消息。
东方之珠 2008-09-24
  • 打赏
  • 举报
回复
A(0),A(1),........,A(5),............A(10),...........,A(15)
tongnaifu 2008-09-24
  • 打赏
  • 举报
回复
举例说明什么间隔
txlk33 2008-09-24
  • 打赏
  • 举报
回复


如有不明白之处 发消息。

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧