Results 1 to 4 of 4

Thread: [RESOLVED] C# Equivalent to CALL in VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2003
    Location
    netherlands
    Posts
    163

    Resolved [RESOLVED] C# Equivalent to CALL in VB

    Hi,

    I used to program in VB sometimes, now i'm using C# due to flexibility of the language.

    I want to know the following.

    In VB i could use "Call" to call a specific procedure to be perfomed.

    Something like.

    Code:
    Call TestAction
    
    Sub TestAction
    'do something
    End Sub
    Is there something similar in C#?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,350

    Re: C# Equivalent to CALL in VB

    There is no equivalent in C# because there's no need for an equivalent. In VB6 and earlier, there were certain circumstances where you had to use the Call keyword to call method. In VB.NET, you never need to use Call. You can do so, and it can be handy in certain rare situations, but it is never required. It is even less required in C#. If you want to call a method in C#, you just go ahead and call it using its name, no keyword(s) required.

    Note that C# does require parentheses to be used when calling a method, which VB.NET does not unless arguments are provided.

  3. #3
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    Re: C# Equivalent to CALL in VB

    Call is not needed you just call the any method by its name like this

    Code:
    TestAction();
    
    private void TestAction()
    {
    //Do Something
    }
    if it has an argument then you call it like this

    Code:
    TestAction("arg");
    
    private void TestAction(string arg)
    {
    //Do Something
    }
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2003
    Location
    netherlands
    Posts
    163

    Re: C# Equivalent to CALL in VB

    That solved the problem. I tried this before, but clearly not in the correct way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width