Hi folks.  I'm looking for a little bit of coding help.  Basically, I'm trying 
to add a UIDatePicker to a UIPopOever and then display the popover.  I've 
started with this SO example.  Unfortunately, I'm getting the dreaded null 
reference exception.  Unfortunately, I'm not getting an error.  I've been 
trying this with different options for a few hours with no success.  Any ideas 
are appreciated.

Code:
                        uid = new UIDatePicker();                        
uid.Mode = UIDatePickerMode.Date;                        uid.Date = 
dateSelected;                        uid.MinimumDate = DateTime.Now;            
            uid.Frame = new RectangleF(0, 44, 320, 216);                        
                UIViewController popoverContent = new UIViewController();       
                 UIView popoverView = new UIView();                        
popoverView.BackgroundColor = UIColor.Black;                        
popoverView.AddSubview(uid);                        popoverContent.View = 
popoverView;                        UIPopoverController popovercontroller = new 
UIPopoverController(popoverContent);                        
popovercontroller.PopoverContentSize = new SizeF(320,264);                      
  
popovercontroller.PresentFromRect(this.btnDateSelected.Frame, this.View,
 UIPopoverArrowDirection.Any, true);
Exception:

System.NullReferenceException: Object reference not set to an instance of an 
object  at 
BoyScoutApplications.MessageA.btnDateSelectediPad_TouchUpInside 
(System.Object sender, System.EventArgs e) [0x000ac] in 
/Users/wallym/SkyDrive/Documents/ScoutingIsForLife/BoyScoutApplications/Screens/iPhone/MessageA.cs:155
  at 
MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30  at (wrapper 
managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain 
(int,string[],intptr,intptr)  at MonoTouch.UIKit.UIApplication.Main
 (System.String[] args, System.String principalClassName, System.String 
delegateClassName) [0x00042] in 
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29  at 
BoyScoutApplications.Application.Main (System.String[] args
I put this out at http://pastebin.com/vFMKyYrG if it is of any help.

Wally
                                          
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to