tags:

views:

39

answers:

2

I have tried others suggestion for using this type and somehow manage to run it, but now I have using the same way but having an error as

Error :' FYP.Form6.listBox1' is inaccessible due to its protection level

I am enclosing code below

Form6 frm4 = new Form6(this.listbox1);

  for (int i=0;i<frm4.listBox1.Items.Count;i++)
  {
   // <P>
   xmlWriter.WriteStartElement("P");
   xmlWriter.WriteAttributeString("","DISP","",frm4.listBox1.Items[i].ToString());
   xmlWriter.WriteString(frm4.listBox2.Items[i].ToString());
   // </P>
   xmlWriter.WriteEndElement();
  }
+1  A: 

My guess, the Modifiers property of listBox1 control of the Form6 form is set to 'private'. Up it to internal or public.

o.k.w
He is using this.listbox1. So, does it really matter, if it has any access specifier.
P.K
`this.listbox1` might be used to populate listBox1 of Form6. The error throws at `frm4.listBox1` not `this.listbox1`. Anyway just my guess as we do not know what's going on in the constructor of `Form6(ListBox)`.:)
o.k.w
A: 

Thanx bro. I really appreciate it.

Umaid
This is not an answer. It should have been a comment on o.k.w.'s answer.
Jon Skeet