Home > Software engineering >  Vb calls compile error consciousness lack of "=", this is how to return a responsibility??
Vb calls compile error consciousness lack of "=", this is how to return a responsibility??

Time:10-07

I define a process
Public sun A (ByVal STR as string)


End sub


Public sub (B)

A (" hello ") 'here hint to sweep the equals sign is how to return A responsibility???
end sub

CodePudding user response:

In VB, call a function or an object method, if you don't need to assign a value, don't need braces,
For example:
A (" hello ")
Rewrite into
A "hello"
Or
Call A (" hello ")

CodePudding user response:

Have recommend this post and add 30 points, the reason is that the problem reflects the VB even BASIC, an easy to ignore the problem,

First of all, 1/f, reference grammar explanation is certainly right, second, the building Lord "pure hand to play" the code is wrong, that is as follows:
Public sun, of course, should be A public sub A play by mistake, here is A little way, the key is, even if the change to public sub A, execution is not !!!!
Don't believe you can try:
 Option Explicit 
Public Sub A (ByVal STR As String)


End Sub
Public Sub (B)

A (" hello ") 'here hint to sweep the equals sign is how to return A responsibility???
End Sub
Private Sub Form_Load ()
B
End Sub


What are the reasons? Because
A (" hello ")
Behind the line, (" hello ") will be integrated as one of the most outer layer is the expression of bracket operation processing, the results of this expression is passed to A parameter, so this kind of writing is also in accordance with the first floor said BASIC grammar rules, is not an error,
Further testing is more obvious, such as change the definition of A to two parameters:
Public Sub A (ByVal STR As String, ByVal str2 As String)
And then use A (" hello ", "ok") to the CALL, then to be an error "lack of=", why we also thought about it, because the BASIC don't want to be A comma operator in the C language, this kind of writing, the system will only as to the two processing parameters, and according to the explanation of grammar rules, 1/f, he should use the CALL A=less or CALL,

BTW : actually coding experience more old BASIC programmer, occasionally may be inadvertently write similar
MsgBox (" ok ")
Such statement, then run is normally through, just do you realize that, of course, why is this?

CodePudding user response:

Thank you very much. Good!

CodePudding user response:

refer to the second floor bcrun response:
have recommend this post and add 30 points, the reason is that the problem reflects the VB even BASIC, an easy to ignore the problem,

First of all, 1/f, reference grammar explanation is certainly right, second, the building Lord "pure hand to play" the code is wrong, that is as follows:
Public sun, of course, should be A public sub A play by mistake, here is A little way, the key is, even if the change to public sub A, execution is not !!!!
Don't believe you can try:
 Option Explicit 
Public Sub A (ByVal STR As String)


End Sub
Public Sub (B)

A (" hello ") 'here hint to sweep the equals sign is how to return A responsibility???
End Sub
Private Sub Form_Load ()
B
End Sub


What are the reasons? Because
A (" hello ")
Behind the line, (" hello ") will be integrated as one of the most outer layer is the expression of bracket operation processing, the results of this expression is passed to A parameter, so this kind of writing is also in accordance with the first floor said BASIC grammar rules, is not an error,
Further testing is more obvious, such as change the definition of A to two parameters:
Public Sub A (ByVal STR As String, ByVal str2 As String)
And then use A (" hello ", "ok") to the CALL, then to be an error "lack of=", why we also thought about it, because the BASIC don't want to be A comma operator in the C language, this kind of writing, the system will only as to the two processing parameters, and according to the explanation of grammar rules, 1/f, he should use the CALL A=less or CALL,

BTW : actually coding experience more old BASIC programmer, occasionally may be inadvertently write similar
MsgBox (" ok ")
Such statement, then run is normally through, just do you realize that, of course, why is this?



Explain clearly never pay attention to the problem

CodePudding user response:

Detail decides success or failure

CodePudding user response:

CodePudding user response:

CodePudding user response:

CodePudding user response:

The need to learn about

CodePudding user response:

Good essence of post to kneel

CodePudding user response:

CodePudding user response:

CodePudding user response:

End sub

CodePudding user response:

You can support

CodePudding user response:

~ ~ ~ under study

CodePudding user response:

Good good learned some new knowledge

CodePudding user response:

Learning how to learn ~ ~

CodePudding user response:

CodePudding user response:

Water army; Pass by,

CodePudding user response:

Points for the French recovery plan

CodePudding user response:

Oooooooooooooooooooooooo learning?

CodePudding user response:

What's the matter, the next thing so difficult?

CodePudding user response:

Sodium hyposulphite junior and senior year

CodePudding user response:

Thank you very much. Good!

CodePudding user response:

It is also recommended, I to CSDN speechless,

CodePudding user response:

Completely look not to understand ah, I want to study for a long time for a long time oh,,,,,,,,nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related