for(int c =1;c<=author.books.count;c++)
{
string author = author.name.ToString();
string author = author.book_name.ToString();
string author = author.published_year.ToString();
string[] row = new string[]{author, book_name, published_year};
dataGridView1.Rows.Add(row);
}
これは私のコードです(同様に)........私は1つのXMLファイルからデータを取得しています. 私の問題は、windows_form.after の gridview でデータを与える 1 つの作成者を選択したときでした。現在選択されている著者データのみを表示したい。
私は次のように試しました:
dataGridView1.Rows.Clear();
forループの前にこのコードをpgmに入れると、pgm全体で「GridView」にデータさえ与えられません。
私は次のように試しました:
if (this.dataGridView1.DataSource != null)
{
this.dataGridView1.DataSource = null;
}
else
{
this.dataGridView1.Rows.Clear();
}
上記と同じように、データは表示されません。
私を助けてください.................