Results 1 to 4 of 4

Thread: an object representation of System ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    376

    an object representation of System ?

    is there an object representation of System that i can Extend upon such that the extended method becomes global.

    Code:
    <Runtime.CompilerServices.Extension()> Public sub globalprocedure(ByVal asystem As ?)

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

    Re: an object representation of System ?

    Do you know what System is? It's a namespace. Objects are instances of type. A namespace and a type are two very different things. A namespace cannot be instantiated, and therefore cannot be extended.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    376

    Re: an object representation of System ?

    i want to create a function like Mid() Rate() MsgBox() Val() that you can access directly instead of making it a method belonging to a class. is there a way to do it?

    btw does these functions all belong to the System Namespace?

  4. #4
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: an object representation of System ?

    1) You shouldn't be using functions like Mid, Rate, MsgBox, or Val because they are VB6 legacy functions. Use the .NET equivalents.

    2) If you want to make functions like this, you would place them inside a module.

    3)
    btw does these functions all belong to the System Namespace?
    No, and for questions like this, the easiest way to find out where they are from is by typing in the function in the IDE, right-clicking on it and clicking "Go To Definition", or, press F2 to see the Object Browser and type in the function name and search. You will see that these functions are contained in different modules under the same namespace.

    Under the Microsoft.VisualBasic namespace:

    MsgBox is apart of the Interaction module.
    Rate is apart of the Financial module.
    Val is apart of the Conversion module.
    Mid is apart of the Strings module.

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