error: Identifier expected


I have this code where at 3 places I get the error: Identifier expected.
Who knows the answer to my problem and is willing to help me?

public void LoadTree() 
            DataSet PrSet = PDataset("SELECT * FROM tree");
            foreach (DataRow dr in PrSet.Tables[0].Rows) 
                TreeNode n2 = new TreeNode(); 
                TreeNode n = new TreeNode(); 
                 n2 = FindNode(dr.["Parent"].Value);     <===========
                 n = tvNotes.Nodes.AddChild(n2,dr.["Name"].Value);   <===========
                 n.ImageIndex = (dr.["ImageIndex"].Value);           <===========
                 if (n.ImageIndex == FolderClose_Image_Index)
                  n.SelectedImageIndex = FolderOpen_Image_Index;
                 n.SelectedImageIndex = n.ImageIndex;
                 int p = (dr.["ID"].Value);
                 n.Text = Pointer(p);

Open in new window

Peter KiersOperatorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Don't you have an extra period?

n2 = FindNode(dr["Parent"].Value);
Peter KiersOperatorAuthor Commented:
yes I have
>>n.ImageIndex = (dr.["ImageIndex"].Value);          
remove the outmost ():
n.ImageIndex = dr.["ImageIndex"].Value;
   >>n2 = FindNode(dr.["Parent"].Value);    
FindNode() needs an object to proceed from: xxx.FindNode()
Fix these two, then we see what whould happen to the second one.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Peter KiersOperatorAuthor Commented:
n.ImageIndex = dr.["ImageIndex"].Value;

Does not work either

Peter KiersOperatorAuthor Commented:
I still get the message: Identifier espected
Peter KiersOperatorAuthor Commented:
This will do:

n.Text = dr["Name"].ToString().Trim();
Peter KiersOperatorAuthor Commented:
Thank you for the help.

Ummm, wasn't the first response the correct answer then?
Kenneth BrownResearch AssociateCommented:
I know youve onlly posted a snippet, but FindNode is a member function of the treeview class.
you can only call it without a treeview object if youre inheriting from that class.
the three errors might thus be stemming from the fact that youre attempting to call FindNode as a global function. but ive no direct experience with this so apologies if im totally mistaken.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.