Private Sub Command1_Click()
Dim x1 As Integer,x2 As Integer,n As Integer
Dim sum As Long
x1=Val(Text1.Text)
x2=Val(Text2.Text)
Sum=0
If x1<x2 Then n=1 Else
For i=x1 To x2 Step n
IfThen
sum=sum+i
Next i
Label3.Caption=“从”& x1 &“到”& x2 &“之前所有奇数的累加和=”& Str(sum)
End Sub