Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

NullReferenceException

A friend and I are working with some Visual C# code and we keep getting the message "System.NullReferenceException: Object reference not set to an instance of an object." How do we fix it? The code is attached.

[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
    public class MainActivity : AppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.homeScreen);
            Button findAirport = FindViewById<Button>(Resource.Id.findAirport);
            Button findPrevious = FindViewById<Button>(Resource.Id.findPrevious);
            Button goHome = FindViewById<Button>(Resource.Id.homeButton);
            findAirport.Click+= (button, e) =>
            SetContentView(Resource.Layout.findNew);
            findPrevious.Click += (button, e) =>
            SetContentView(Resource.Layout.loadPrevious);
            goHome.Click += (button, e) =>
            SetContentView(Resource.Layout.homeScreen);
0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors