Is it possible to call a VB function without the parenthesis?

前端 未结 4 406
-上瘾入骨i
-上瘾入骨i 2021-01-03 07:17

I am looking at VB6 code and I see a statement as follows -

       Public Sub CheckXYZ(abc As Integer)

       If abc <> pqr Then SetVars abc
<         


        
4条回答
  •  长发绾君心
    2021-01-03 08:06

    Sub calls with parameters do not require the parenthesis. Paranthesis are only required for a function returning a result.

    Private Sub Testy1()
        Function1 "Testy2" ' does not require parenthesis
        Debug.Print Function1("Testy3") ' does require parenthesis
    End Sub
    
    Private Function Function1(str as String) as Boolean
        Function1 = True
    End Function
    

提交回复
热议问题