You must Sign In to post a response.
  • Category: Windows

    How to close the application using button c# windows mobile?

    Hi members,

    I am learning windows mobile application using two buttons button1 message box another button closing the application how to use please guide me.


    here is the coding

    private void button1_Click(object sender, RoutedEventArgs e)
    {
    MessageBox.Show("Lumia 800");
    }

    private void button2_Click(object sender, RoutedEventArgs e)
    {

    }

    wgs
    blackcapss
    vramesh2019@gmail.com
  • #763197
    There are different ways of application exit, better to use Application.Terminate() method, according to MSDN "The Terminate method does not raise any application lifecycle events. Before you call this method, you must save the state of the app."
    read more about closing methods here
    https://msdn.microsoft.com/en-us/library/windows/apps/dn148258(v=vs.105).aspx#BKMK_best

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #763198
    Hello,

    You can use Application.Current.Terminate() method.

    Example :
    private void Exit_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
    Application.Current.Terminate();
    }

    You can go through the below link of MSDN Code Library for more reference :
    https://msdn.microsoft.com/en-us/library/windows/apps/dn148258%28v=vs.105%29.aspx

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


Sign In to post your comments