2 回答

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊
Option Base 1
Dim s As String
'讀取數(shù)據(jù)in4.dat中的數(shù)據(jù)并用s代替
Private Sub Command1_Click()
Open App.Path & "\in4.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
Text1.Text = s
End Sub
Private Sub Command2_Click()
Dim m As Integer
If Len(s) = 0 Then
MsgBox "請(qǐng)先使用“讀數(shù)據(jù)”功能!"
Else
If Text1.SelLength = 0 Then
MsgBox "請(qǐng)先選中文本!"
Else
t = ""
For i = 1 To Text1.SelLength
c = Mid(Text1.SelText, i, 1)
If c <> " " Then
t = t + c
Else
If LCase(t) = "the" Then
m = m + 1
End If
t = ""
End If
Next i
Text2.Text = Str(m)
End If
End If
End Sub
添加回答
舉報(bào)