0
私はwinformのリストボックスに新しい行を表示したいと思います。私はバックハンドクラスにこのようなコードを持っています。ここ文字列配列に新しい行を挿入して表示する方法は?
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
文字列が[]配列は、XMLファイルの要素のために、この
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
}
例のようなコードが含まれているUIクラスに
enter code here
<person name="John"/>
を返されます。これは、属性を表示返すリストボックスの名前と値をリストボックスに1行で入力します。
は、属性名:名前は、属性値:ジョン
しかし、私はそれがlistboxasにこのように表示させたい:
は、属性名:
属性値に名前を付ける:ジョン
あなたが教えてもらえますどこが間違っているの?あなたの助けのための おかげで...
が動作していない属性ごとに2回線を使用します.. –
私は解決のために私のポストを編集しました – RvdK