Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i, j, m, n As Integer
        i = CInt(TextBox1.Text)
        j = CInt(TextBox2.Text)
        If i > j Then                           ' 判断两个数的大小
            m = j
            j = i                               ' j中存储大数
            i = m                               ' i中存储小数
        End If
        For n = j To i * j                       ' 从大数循环开始，至两数乘积为止
            If n Mod i = 0 And n Mod j = 0 Then     ' 判断i和j是否都能被整除
                Exit For                        ' 如果都能被整除则退出循环
            End If
        Next
        TextBox3.Text = n                       ' 输出最小公倍数
    End Sub
End Class
