Dim x1, x2 Private Function f(a, b, fun) 'x()初值,目标函数多项式 x1 = a x2 = b f = fun End Function Private Sub Command1_Click() Label1.Caption = f(2, 2, x1 ^ 2 + 2 * x1 * x2 + x2 ^ 2) End Sub