Я хочу показать новую строку в моем списке на моей winform. У меня такой код на моем классе backhand.Как вставить и отобразить новую строку в массиве строк?
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
здесь возвращает строку [] массив будет возвращен в класс UI, который содержит код, как этого
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
}
Пример для XML-файл элемента
enter code here
<person name="John"/>
атрибута Это показывает имя и значения, подобные этому в списке в одной строке:
Имя атрибута: имя, Значение атрибута: Джон
Но я хочу это будет отображаться как это в listboxas:
Имя атрибута: имя
значение атрибута: John
Можете ли вы сказать мне, где я ошибаюсь? Спасибо за вашу помощь ...
\ п не работает .... я не могу использовать вектор/список в настоящее время .. –
Я отредактировал сообщение для решения – RvdK