Results 1 to 29 of 29

Thread: VB Runtime Functions

Hybrid View

  1. #1
    Fanatic Member EntityX's Avatar
    Join Date
    Feb 2007
    Location
    Omnipresence
    Posts
    798

    Re: VB Runtime Functions

    Jmc you said

    I always recommend to people to avoid such functions unless they genuinely add value. MsgBox is a prime example of a function that I think should never be used. Many others who recommend not using them cite the fact that they may be deprecated in a future version as one of the reasons.
    Is using MessageBox.Show equally offensive and if you don't use either what do you think is the recommended way of doing what a message box does?
    Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.

    "Persistence is the magic of success." Paramahansa Yogananda

  2. #2

    Thread Starter
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB Runtime Functions

    Quote Originally Posted by EntityX
    Jmc you said



    Is using MessageBox.Show equally offensive and if you don't use either what do you think is the recommended way of doing what a message box does?
    I do use MessageBox.Show. MsgBox does not do anything that MessageBox.Show doesn't. MsgBox has been implemented specifically so it behaves exactly like the MsgBox function from VB6, as have the rest of the Runtime functions. As has been said, they are all implemented in VB.NET, so they are not actually VB6 functions, but they exist specifically to mimic VB6 functions in syntax and behaviour. Some add value, others don't.

    MsgBox is an example of one that doesn't. All MsgBox does is translate the parameters, call MessageBox.Show, then translate the return value. What's the point of that? Why ask Peter to ask Paul when you can just ask Paul yourself? The answer is that VB6 developers have always called the MsgBox function so they continue to do so since it's available. I can't see any purpose other than to provide a familiar interface to upgrading VB6 developers on a commonly used function. It serves no useful purpose in the context of an actual program.

    That's not the case for all Runtime functions but MsgBox is certainly a poster-child for those opposed to their existence. Now, why are there those who are opposed to their existence? Why do we care? Basically, it's because VB.NET is not VB6 and we don't want it to feel like VB6. Pretty sad, but not as sad as needing a MsgBox function to feel comfortable with a new language. Does anybody want me to shut up now?
    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

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