Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Dismiss Action Sheet with Custom Done Button (IO7) BLOWS UP 2nd Time in Main.CS A System.NullReferen

$
0
0

Whats different between the first time I click and the Second and Third where it fails?

In Main.cs VolcorpMobile.Application.Main (args={string[0]}) in /Users/barry/Projects/VolcorpMobile/VolcorpMobile/Main.cs:16

Get Object reference not set to an instance of an object

public class Application
{
    // This is the main entry point of the application.
    static void Main (string[] args)
    {
        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        UIApplication.Main (args, null, "AppDelegate"); - > HERE IT BLOWS UP
    }
}

Page where I create an actionsheet.

_memberRatesActionSheet = new UIActionSheet ("Select Rates:") { Style = UIActionSheetStyle.BlackTranslucent };

            doneButton.SetTitle ("Done !", UIControlState.Normal);


            doneButton.Frame = new RectangleF (ParentViewController.View.Frame.Width - 80, 7, 71, 30);
            doneButton.TouchUpInside += (s, e3) => {
                _memberRatesActionSheet.DismissWithClickedButtonIndex (14, true);
            };


            _memberRatesActionSheet.AddSubview (doneButton);

            _memberRatesActionSheet.AddButton ("1");
            _memberRatesActionSheet.AddButton ("2");
            _memberRatesActionSheet.AddButton ("3");
            _memberRatesActionSheet.AddButton ("4");
            _memberRatesActionSheet.AddButton ("5");
            _memberRatesActionSheet.AddButton ("6");
            _memberRatesActionSheet.AddButton ("7");
            _memberRatesActionSheet.AddButton ("8");
            _memberRatesActionSheet.AddButton ("9");
            _memberRatesActionSheet.AddButton ("10");
            _memberRatesActionSheet.AddButton ("11");
            _memberRatesActionSheet.AddButton ("12");
            _memberRatesActionSheet.AddButton ("13");
            _memberRatesActionSheet.AddButton ("14");
            _memberRatesActionSheet.AddButton ("Cancel");

            _memberRatesActionSheet.CancelButtonIndex = 14; 

            _memberRatesActionSheet.ShowInView (ParentViewController.View);

            _memberRatesActionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
                this.btnRatesSelected.SetTitle (b.ButtonIndex.ToString () + " - " + _memberRatesActionSheet.ButtonTitle(b.ButtonIndex).ToString(), UIControlState.Normal);

            };

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>