Results 1 to 7 of 7

Thread: [RESOLVED] Msgbox v MessageBox

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] Msgbox v MessageBox

    Ok another one of these which is better and why choose one over the other threads.

    Is there any big difference between the Msgbox and MessageBox.

    from what i can see the messagebox has a lot more options to it, but the Msgbox for me is just that much more simpler.

    Also i've noticed that after you do a messagebox.show i try set focus to a control after but it does not focus to the control

    whats everyone else view?
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Msgbox v MessageBox

    MsgBox is part of the Microsoft.Compatibility namespace as it came from VB6.

    MessageBox is the .NET class and it has more features.

    You should try to use the MessageBox class wherever possible.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Msgbox v MessageBox

    MessageBox.Show("there is an erro", "Mytitle", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

    textbox1.focus
    textbox1.selectall

    however the focus and the select all does not work with the messagebox, whereas it does with msgbox
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: Msgbox v MessageBox

    Quote Originally Posted by Strider
    MessageBox.Show("there is an erro", "Mytitle", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

    textbox1.focus
    textbox1.selectall

    however the focus and the select all does not work with the messagebox, whereas it does with msgbox

    Hi,

    Works OK for me. (I cut & pasted your code)
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Msgbox v MessageBox

    hmmm it does now for me, that didnt a few mins ago... ah well
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

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

    Re: Msgbox v MessageBox

    Quote Originally Posted by tr333
    MsgBox is part of the Microsoft.Compatibility namespace as it came from VB6.

    MessageBox is the .NET class and it has more features.

    You should try to use the MessageBox class wherever possible.
    MsgBox has nothing to do with the Microsoft.Comapatibility namespace, which is provided only for the use of the VB6 upgrade wizard in order to allow certain things in VB6 that do not have .NET equivalents to still work when upgraded. MsgBox is a function from the Microsoft.VisualBasic namespace, which includes fully .NET implementations of functions that provide the same functionality as similarly named functionsn that exist in VB6. MsgBox and MessageBox.Show have essentially the same functionality because MsgBox actually calls MessageBox.Show itself. There is next to no difference between the two performance-wise as well, except that there is really no point making the extra function call when you don't have to. In short, there is no reason not to use MessageBox.Show. It is just that VB6 developers are already comfortable with MsgBox and are reluctant to change without a compelling reason, and there really is no compelling reason.
    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

  7. #7
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: Msgbox v MessageBox

    Quote Originally Posted by Strider
    hmmm it does now for me, that didnt a few mins ago... ah well

    No worries. My wife often says that to me
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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