Hi Friends,
i want to display a new row in my listbox on my winform. I have a code like this on my backhand class.
string[] a = new string[att]; //String array contains the attributes.
if (attCol != null)
for (int i = 0; i < att; i++) //Loop through entire attributes
{
a[i] = " Attribute name: " + attCol[i].Name + " , " + "Attribute value: " + attCol[i].Value; //Retrieving attribute name and values from the array.
}
return a; //returning the string array to be displayed in listbox
here return a string[] array will be returned to UI class which contains the code like this
string[] attributecoll = new string[xNode.Attributes.Count]; //Declaration of String array where all the attributes of selected node are returned
attributecoll = classObj.selectedNode(xNode); //calling the selectedNode method from backend class and store it in a string array
foreach (string c in attributecoll)
{
listBox1.Items.Add(c); //adding the name and values of Attribute in the Listbox
}
Example for xml file element
enter code here
<person name="John"/>
This displays attribute name and values like this in listbox in a single line:
Attribute Name:name , Attribute Value:John
But i want it to be displayed like this in listboxas :
Attribute Name : name
Attribute Value : John
Can you tell me where i m going wrong? Thanks for your help...