Passing Data Types To A Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CloeteJ
    New Member
    • Jan 2008
    • 1

    Passing Data Types To A Function

    Using VB.Net

    Could someone please tell me how to pass a type to a function, for example.

    MyFunction (“Name” , Integer)
    ---------------------------------------
    Public Function MyFunction (ByVal MyName as String , ?????????)

    End function
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    why can't you do this...

    Public Function MyFunction(ByVa l MyName As String, ByVal a As Integer)

    End Function

    MyFunction(“Nam e” , 123)

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      I agagreewith james


      Better Than Yesterday (-.-)

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Ignore them, CloeteJ, they obviously didn't understand the question. :)

        In VB6 you can test, for example, If TypeOf Object Is OptionButton. Perhaps you can search your documentation for extensions to this.

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Originally posted by CloeteJ
          Using VB.Net

          Could someone please tell me how to pass a type to a function, for example.

          MyFunction (“Name” , Integer)
          ---------------------------------------
          Public Function MyFunction (ByVal MyName as String , ?????????)

          End function
          Hi,

          I guess, your Function Returns Integer, so to define that :

          [code=vb]
          Public Function MyFunction (ByVal MyName as String ) As Integer
          End function
          [/code]

          Regards
          Veena

          Comment

          Working...