Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
private void btnNext_Click(object sender, EventArgs e)
       {
           RadioButton rbProjectType;

           if (iPnlNumber == 1)
           {
               this.pnlInstallerGuide.Visible = false;
               this.pnlProjectType.Visible = true;
               lblInstallerGuide.Visible = false;
               lblProjectTitle.Visible = true;
               btnBack.Enabled = true;
               iPnlNumber = 2;
               if (!bBackbtn)                {
                   foreach (DataRow drParentElement in dsToReadXmlFile.Tables[cProject].Rows)
                   {
                       string sParentElement = drParentElement[cType].ToString() + drParentElement[cLanguage].ToString();

                       addRadioButtonControl(drParentElement[cValue].ToString(), sParentElement, ((Convert.ToInt32(drParentElement[cProject_Id].ToString()) + 1) * 35));
                   }
               }
           }
Posted
Updated 11-Apr-11 19:21pm
v4
Comments
Eduard Keilholz 8-Apr-11 6:19am    
What is your question?
Sandeep Mewara 8-Apr-11 6:20am    
Had you given the exact line, we could have all told on the possible objects. Yet, the answer by me should be more than enough and you should be able to resovle it now.

Object reference not set to an instance of an object

This error happens when you try to use a property of an object that is null.

A simple use of Visual studio DEBUGGER can tell you the object because of which it is happening. Just look at the stack trace and put a debugger on that line. Check the objects of that line and see if any one is null and you are trying to use that objects property. Handle the same.
 
Share this answer
 
Comments
bipin9 8-Apr-11 6:40am    
exception is found for cProject
foreach (DataRow drParentElement in dsToReadXmlFile.Tables[cProject].Rows)
Sandeep Mewara 8-Apr-11 6:42am    
So, you say, issue resolved?
OR you are asking me what and where and how to resolve?
bipin9 8-Apr-11 7:00am    
sorry i asked wrong question first time
yes where and how to resolve is it related to xml file if yes then how
Sandeep Mewara 8-Apr-11 7:06am    
Did you try? Sounds like dsToReadXmlFile is null and you are trying to access it's table
bipin9 8-Apr-11 7:13am    
thanks
Why don't you try debugging your code and check the values of all the objects to figure out which one is null?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900