求vb程序设计,在文本框中输入一些英语单词,统计空格的个数,上机考试的题目
1个回答
展开全部
Private Sub Command1_Click()
Dim a As String
a = Text1.Text
Dim n As Long
n = 0
Do Until InStr(a, " ") = 0
a = Replace(a, " ", "", , 1)
n = n + 1
Loop
Print n'打印空格个数
End Sub
Dim a As String
a = Text1.Text
Dim n As Long
n = 0
Do Until InStr(a, " ") = 0
a = Replace(a, " ", "", , 1)
n = n + 1
Loop
Print n'打印空格个数
End Sub
追问
请问下,如果想添加一个就是专门的框,显示空格的个数怎么弄呢?
追答
在界面上创建一个文本框 text2,text=n
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询