2009年1月12日 星期一

麗山50題之2

image

image 

image

image

image

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button2.Enabled = True
        Button1.Enabled = False
        Dim a, b, c As Integer
        a = 0
        b = 1
        Do
            c = InputBox("輸入第" & a + 1 & "筆", "輸入對話框")
            If c <> 0 Then
                b = b * c
                a = a + 1
            End If
        Loop Until c = 0
        TextBox1.Text = a
        TextBox2.Text = b
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button1.Enabled = True
        Button2.Enabled = False
        End
    End Sub
End Class

1 則留言: