Results 1 to 3 of 3

Thread: How to make the ShowDialog method return a custom object

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    How to make the ShowDialog method return a custom object

    Everyone else probably already knows this but I just needed a form to return an object as a result and so I found a way to do it. Before I've used delegates to call a method when the form was closing or used a ByRef variable, however the delegate isn't ideal for most situations and the ByRef sometimes didn't work. So this is an example of Shadowing the ShowDialog method to return your own object instead of DialogResult. I hope someone finds it useful. You could also use this method for a custom MsgBox which came up here not too long ago.

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651
    Hi Edneeis

    I tried it and its
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU

    I've been working with this all day (I just got 2003 .NET yesterday) and kept getting StackOverload errors in the calling form. I was not aware of the MyBase keyword so I was using what I knew, which as you might of guessed, was Me. Changed it and all is well.

    Did I say Thank You?
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

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