Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Object reference not set to an instance of an object

$
0
0

Hi,

I am working on an asp.net/C# project and I am a beginner in webprogramming. I get the below error on runtime:

"Object reference not set to an instance of an object."

Below is my code:

protected void Page_Load(object sender, EventArgs e)
        {
            txtUsername.Focus();
            if (cmbThemes.SelectedItem.Text=="Red")
            {
                pnlSignin.Border.BorderColor = Color.Orange;
            }
        }

cmbThemes is a combobox.

I am getting the error inside the if condition. pnlSignin is the panel i am using and getting the error there.

Thanks in advance


Viewing all articles
Browse latest Browse all 23244

Trending Articles



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