what are the methods to call a method from in another method in .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandubhoreddy
    New Member
    • Apr 2010
    • 1

    what are the methods to call a method from in another method in .net

    i know one method like
    Code:
    sub add(x,y)
      call mul(a,b)
    end sub


    plz send me another type......?
    Last edited by Frinavale; Apr 13 '10, 03:23 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    What?

    "to cal a method" ?? Is 'cal' supposed to be short for 'calculate'?

    Why don't you try taking more than 10 seconds to write your questions and actually explain your situation.

    Comment

    • semomaniz
      Recognized Expert New Member
      • Oct 2007
      • 210

      #3
      What exactly are you trying to do ? Please explain

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Chandubhoreddy,

        You should research the topic of "scope" in VB.NET

        In this case you would want to specify that the subroutine "add" has a Public scope so that other code can call it.

        You would define your subroutine as such:
        Code:
        Public Sub Add(ByVal x As Integer, ByVal y As Integer)
          'do stuff
        End Sub

        Now you can call this code from a class that uses your object.

        If you had defined your subroutine as:
        Code:
        Private Sub Add(ByVal x As Integer, ByVal y As Integer)
          'do stuff
        End Sub
        Then you would not be able to call this code from outside of the object.

        The "Public" and "Private" keywords are known as scope modifiers.
        Scope is what lets you set the visibility (or accessibility) of variables, properties, functions, events, and subroutines.... this ties into a much bigger topic of encapsulation and good software design but you should start by looking up scope.

        -Frinny

        Comment

        Working...