【加试题】用VB编写程序,在文本框Text1中输入任意字符串s,统计s中数字字符串的数值和(如输入字符串“ab123dr34fg9de”,则输出166,即123+34+9=166).并存Label3中输出结果。程序设计界面如图所示:
根据算法将下列程序补充完整。
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
①
i=1:sum=0
Do While i<=n
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+ ②
i=j
EndIf
i=i+1
Loop
Label3.Caption=Str(sum)
End Sub