General discussion

Locked

Procedure in VB

By NetMan_OVO ·
I have a procedure named
Private Sub Mark_To_Delete(TT_No As Integer, TT_Type As String)

When I try to call Mark_To_Delete(1, "TT")
Give Error
**
VB Compiler Error
Required: =
**

But If
Private Sub Mark_To_Delete(TT_No As Integer)
& then try to call Mark_To_Delete(1)
all works fine

How can I pass 2 parameter.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Procedure in VB

by Peyison In reply to Procedure in VB

How are you calling it? Try doing it like:

Mark_To_Delete 1, "TT"

Parentheses are used when calling a function, but not when calling a sub.

In the second example, when you put a single parameter in parentheses, it works because putting parentheses around a parameter also means to resolve it first before passing it.

So if you called a Sub called Verify like:

Verify tbxName

you are passing a text box, but like:

Verify (tbxName)

You are passing the contents of the textbox since (tbxName) will resolve to tbxName.Text.

So, when you call Mark_To_Delete (1), it is resolving to Mark_To_Delete 1.

Sorry if this is more than you wanted to know :) , but try calling without parentheses.

Hope this helps.

Collapse -

Procedure in VB

by NetMan_OVO In reply to Procedure in VB
Collapse -

Procedure in VB

by NetMan_OVO In reply to Procedure in VB

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums