【加试题】小明编写了一个统计字符串中数字字符串之和的VB程序(如字符串“ab12.3cd34ef9”,中数字字符串之和为58:12+3+34+9),运行界面如图所示。在文本框Text1中输入字符串s,单击“统计”按钮Command1,在Label3中输出统计结果。
实现上述功能的VB程序代码如下,但加框处代码有错,请改正。
Private Sub Command1_Click()
Dim s As String, ch As String
Dim ch2 As String, sum As Double
Dim n As Integer, i As Integer
s = Text1.Text
n = Len(s)
i = 1: sum = 0
Do While
'①
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
j = i
ch2 = Mid(s, j, 1)
Do While ch2 >= "0" And ch2 <= "9"
j = j + 1
ch2 = Mid(s, j, 1)
Loop
sum = sum + Val(
) '②
i = j
End If
i = i + 1
Loop
Label3.Caption = Str(sum)
End Sub
①{#blank#}1{#/blank#} ②{#blank#}2{#/blank#}