Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

error: Identifier expected

Hi,

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?

P.
public void LoadTree() 
        { 
            DataSet PrSet = PDataset("SELECT * FROM tree");
            tvNotes.BeginUpdate();
            tvNotes.Nodes.Clear();
            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;
                 }
                 else
                 n.SelectedImageIndex = n.ImageIndex;
                 int p = (dr.["ID"].Value);
                 n.Text = Pointer(p);
                }
            tvNotes.EndUpdate();
            }

Open in new window

Avatar of mastoo
mastoo
Flag of United States of America image

Don't you have an extra period?

n2 = FindNode(dr["Parent"].Value);
Avatar of Peter Kiers

ASKER

yes I have
ASKER CERTIFIED SOLUTION
Avatar of trestan
trestan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
n.ImageIndex = dr.["ImageIndex"].Value;

Does not work either

P.
I still get the message: Identifier espected
This will do:

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

peter
Ummm, wasn't the first response the correct answer then?
Avatar of Kenneth Brown
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.