I am a beginner of c# and currently working on a project. I am facing some problems now.
I have a list view, where the list view will navigate rows in the data table. There is some errors in
the codes below, may i know what's wrong with it and how should i correct it so that this can works
correctly? Or is there any other way to do so?
//building a list view
ListViewItem
item; DataRow row; for (int i=0; i < dataset1.Tables["employee"].Rows.Count; i++){
row = dataset1.Tables[
"employee"].Rows; //erroritem = new ListViewItem(row["myColumn"]); //error
item.Tag = i;
}
Thanks.
Andrzej WegierskiPosted Jul 28, 2005, 3:15 AM
{
DataRow row = dataset1.Tables["employee"].Rows[i]; //ok ... and faster
ListViewItem item = new ListViewItem(row["myColumn"].ToString()); //ok
item.Tag = i;
// of course
myListView.Items.Add(item); }
Not tested