2017年11月21日 星期二

[ VB2010 ] - 007 副程式流程004

[ VB2010 ] - 007 副程式流程004


●副程式內呼叫副程式:

●副程式傳出結果成為另一個副程式的引數:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox4.Text = CStr(X(4))
    End Sub

    Function X(ByVal Param1 As Integer) As Integer
        TextBox1.Text = CStr(Param1)
        Return Param1 * Y(Param1 + 1)
    End Function

    Function Y(ByVal Param1 As Integer) As Integer
        TextBox2.Text = CStr(Param1)
        Return Param1 * Z(Param1 + 1)
    End Function

    Function Z(ByVal Param1 As Integer) As Integer
        TextBox3.Text = CStr(Param1)
        Return Param1
    End Function

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox4.Text = CStr(X1(Y1(Z1(2))))
    End Sub


    Function X1(ByVal Param1 As Integer) As Integer
        TextBox3.Text = CStr(Param1)
        Return Param1 * (Param1 + 1)
    End Function

    Function Y1(ByVal Param1 As Integer) As Integer
        TextBox2.Text = CStr(Param1)
        Return Param1 * (Param1 + 1)
    End Function

    Function Z1(ByVal Param1 As Integer) As Integer
        TextBox1.Text = CStr(Param1)
        Return Param1
    End Function

End Class

沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...