locked
Messagebox default button choice RRS feed

  • Question

  • Hi all ,

    I want to ask about MessageBox behavior ..

     If my program shows a (Yes , No) messagebox ..

    Is there a way to make a default choice for the messagebox that happens after a period of time if the user doesn't choose (Clicked ) Yes or No buttons.

    Note : I'm not talking about choosing a button to be the default one .

     

    Many thanks in advance.

     


    Please remember to mark the replies as answers if they help ,Don't forget to Vote the answer as Helpful if it helps
    Wednesday, April 21, 2010 7:15 AM

Answers

  • I think what you should do is create a new form with your two buttons, one with a DilogResult property set to OK and the other set to ABORT.

    Then you use the ShowDialog function of the form and make your treatments corresponding to the result that you obtain.

    You can add a timer to the form with a value corresponding to the time after which you want to select your default choice. Then on the timer_tick function you set the DialogResult property of the window to the default result that you want.

     

    Thursday, April 22, 2010 10:10 AM
  • I don't think what you are asking for is possible with the default MessageBox() api that is provided. You could, of course, implement a custom dialog which behaves according to your requirements, or probably use Notifications with menu to do the same, though I feel a custom dialog is a much better option.

     

    Prabhu
    www.geekswithblogs.net/techtwaddle

    Wednesday, April 21, 2010 11:35 AM
  • Well I never tried it and it doesn't seems really easy to do. You can look at this link :

    http://stackoverflow.com/questions/243671/display-form-non-maximized-with-borders-on-windows-mobile

    I didn't try so I don't know if it works. Hope it can help you anyway!

    Thursday, April 22, 2010 12:52 PM

All replies

  • I don't think what you are asking for is possible with the default MessageBox() api that is provided. You could, of course, implement a custom dialog which behaves according to your requirements, or probably use Notifications with menu to do the same, though I feel a custom dialog is a much better option.

     

    Prabhu
    www.geekswithblogs.net/techtwaddle

    Wednesday, April 21, 2010 11:35 AM
  • Many thanks Prabhuk for your reply ,

    Do you have any article talking about Implementing a custom dialog ??

     

    Many thanks in advance.


    Please remember to mark the replies as answers if they help ,Don't forget to Vote the answer as Helpful if it helps
    Thursday, April 22, 2010 6:02 AM
  • Hi Ashraf, sorry, I don't currently have an article on it. I think it's a good topic, I will write one soon.


    Prabhu
    www.geekswithblogs.net/techtwaddle
    Thursday, April 22, 2010 9:56 AM
  • I think what you should do is create a new form with your two buttons, one with a DilogResult property set to OK and the other set to ABORT.

    Then you use the ShowDialog function of the form and make your treatments corresponding to the result that you obtain.

    You can add a timer to the form with a value corresponding to the time after which you want to select your default choice. Then on the timer_tick function you set the DialogResult property of the window to the default result that you want.

     

    Thursday, April 22, 2010 10:10 AM
  • Hi Sktdre,

    How can I make a form that appears like a messagebox in windows mobile ( Appears in the center of the screen with a margin surrounding it ???

     

    Many thanks in advance.


    Please remember to mark the replies as answers if they help ,Don't forget to Vote the answer as Helpful if it helps
    Thursday, April 22, 2010 12:22 PM
  • Well I never tried it and it doesn't seems really easy to do. You can look at this link :

    http://stackoverflow.com/questions/243671/display-form-non-maximized-with-borders-on-windows-mobile

    I didn't try so I don't know if it works. Hope it can help you anyway!

    Thursday, April 22, 2010 12:52 PM
  • Hi skydre ,

    I played around with form properties and it is almost done , As soon as I finish it I'll add the properties and changes here so it may help someone else.

    Many thanks for your help , It's really appreciated.

    Regards :MrAlshahawy


    Please remember to mark the replies as answers if they help ,Don't forget to Vote the answer as Helpful if it helps
    Thursday, April 22, 2010 1:18 PM
  • Hi, I wrote up a post on it, using native code (c++). If you can share details about the managed version, it'll be great!

    http://geekswithblogs.net/TechTwaddle/archive/2010/04/22/applications-how-to-create-a-custom-dialog-box-for-windows.aspx

     

    Prabhu
    www.geekswithblogs.net/techtwaddle

    Thursday, April 22, 2010 2:25 PM
  • Hi ashraf fawzy,

    Following are two articles about creating custom messagebox:

    http://www.christec.co.nz/blog/archives/134
    http://www.opennetcf.com/Default.aspx?tabid=130

    They also have sample code.

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, April 23, 2010 7:26 AM