Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6759637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:58:09+00:00 2026-05-26T13:58:09+00:00

I am experiencing a problem while choosing Yes on my MessageBox with buttons Yes

  • 0

I am experiencing a problem while choosing Yes on my MessageBox with buttons Yes or No.

Object reference not set to an instance of an object.

From line:

AddEntryWindow addWindow = new AddEntryWindow
    (this, storedAuth.UserName, storedAuth.Password);

I don’t understand what’s the problem since few lines after this, is the same statement. How can I fix this?

Fixed

private void tsmiAddEntry_Click(object sender, EventArgs e)
{
    if (storedAuth == null)
    {
        DialogResult result = MessageBox.Show
            ("You must log in before you add an entry." 
            + Environment.NewLine + "You want to authenticate?",
            "Information", MessageBoxButtons.YesNo, 
            MessageBoxIcon.Information);

        if (result == DialogResult.Yes)
        {
            AuthenticationWindow authWindow = 
                new AuthenticationWindow();
            authWindow.ShowDialog();
            storedAuth = authWindow.Result;

            AddEntryWindow addWindow = new AddEntryWindow
                (this, storedAuth.UserName, storedAuth.Password);
            addWindow.ShowDialog();
        }
    }
    else
    {
        AddEntryWindow addWindow = new AddEntryWindow
            (this, storedAuth.UserName, storedAuth.Password);
        addWindow.ShowDialog();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:58:10+00:00Added an answer on May 26, 2026 at 1:58 pm

    Look this statement
    if (storedAuth == null)

    and you accessing property of a null object. if it is necessary object then assign value to this object then access UserName and Password.

    this is reason of error.. you should not use storedAuth.UserName, storedAuth.Password) in the following statement. use some default value like “” or “Default”

    AddEntryWindow addWindow = new AddEntryWindow
    (this, storedAuth.UserName, storedAuth.Password);
    addWindow.ShowDialog();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently experiencing a problem while trying to set up a project to deploy
Is anyone else experiencing this problem where if you programmatically set the selected state
I'm experiencing a strange and intermittent problem creating an RMI registry from within the
I'm experiencing a strange problem while trying to use the Ajax.BeginForm method of ASP.NET
I'm experiencing a problem while trying to use google maps api v3 (with marker
Problem description After a while of running my java server application I am experiencing
I'm experiencing null reference exception when I'm attempting to return a value from a
I'm experiencing this problem: I want to add the Google Maps API to my
I am experiencing a problem with the following code in some versions of Internet
I have a Windows Server 2003 64-Bit VPS, and I'm experiencing a problem with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.