[mono-android] Dialog Box Button click code?

kailua ivan at kailuaboy.com
Fri Jun 22 04:55:13 UTC 2012


I am having difficulty in tying to get my /dialog box button/ clickable. In
fact, VS is throwing an exception.

Here is the dialog box code I am using:

Dialog dialog;
            dialog = new Dialog(this);
            dialog.SetContentView(Resource.Layout.dialog_items);
            dialog.SetTitle("Refresh"); 
            dialog.SetCancelable(true);
            //Ok

            var btnMonthS =
FindViewById<Button>(Resource.Id.btnMonthSubtract);

*//I have tried the following different button clicks. I see no guidance as
to which one I should use.*
btnMonthS.Click += (sender, e) => 
 {
//BUTTON CLICKED
}

btnMonthS.Click += delegate
{
//BUTTON CLICKED
}

*//BOTH OF THE ABOVE THROWS THE SAME EXCEPTION*
*//E/mono    ( 1284): Unhandled Exception: System.NullReferenceException:
Object reference not set to an instance of an object
*

Please let me know what simple code I need in order to execute the button.

Thank you in advance.

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Dialog-Box-Button-click-code-tp5710483.html
Sent from the Mono for Android mailing list archive at Nabble.com.


More information about the Monodroid mailing list