What is the difference between Sub and Function in VB6?

前端 未结 8 1853
孤城傲影
孤城傲影 2020-12-25 09:57

I am going through some old VB code and I run into function definitions like these -

 Private Function ExistingCustomer(Index As Integer, Customer As String)         


        
相关标签:
8条回答
  • 2020-12-25 10:40

    A function holds data and code. But a subroutine contains only code, but not data.

    0 讨论(0)
  • 2020-12-25 10:43

    In function we can return values as boolean, string and other data data types.

    but sub does not return any thing. it just executes code and instruction that we give. These are also regarded as methods

    Sub is also used in control's events and these events also not return any value.

    for example the click event of a command button: Private sub cmd_click()

    end sub

    0 讨论(0)
提交回复
热议问题