Hi;
I am having an issue with loading a list view control with data from a datatable. What happens is that some rows will appear as normal, and other will not. For example, the first row will appear as expected having all of the cells filled with data. The second row or third row will not but the last row will contain data as expected. Which row display data and which rows don't is not consistant from one run to the next. I don't understand what would cause this to happen. Is there some property that controls this? See Listview load code snippet below:
this.listViewColumns.Items.Clear();
this.listViewColumns.Show();
this.listViewColumns.Visible = true;
int intItems=0;
foreach(DataRow row in _dtReturned.Rows)
{
//Loads the Import Column and Level columns.
this.listViewColumns.Items.Add(row[0].ToString().Trim()).SubItems.Add(_TableName.ToString().Trim());
//Loads Star Column column.
this.listViewColumns.Items[intItems].SubItems.Add(row [0].ToString().ToLower().Trim());
//Load Import_Type/Size/Dec column;
string _impSzDec = row[1].ToString() + "/" + row[2].ToString() + "/" + row[4].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_impSzDec.ToString());
//Load Star Data Type Column.
this.listViewColumns.Items[intItems].SubItems.Add(row[5].ToString());
//Load Star Size column.
string _cstSz = row[2].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_cstSz.ToString());
//Load Star Decimals column.
string _cstDec = row[4].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_cstDec.ToString());
this.listViewColumns.Enabled = true;
}
Thanks
jbsys
I am having an issue with loading a list view control with data from a datatable. What happens is that some rows will appear as normal, and other will not. For example, the first row will appear as expected having all of the cells filled with data. The second row or third row will not but the last row will contain data as expected. Which row display data and which rows don't is not consistant from one run to the next. I don't understand what would cause this to happen. Is there some property that controls this? See Listview load code snippet below:
this.listViewColumns.Items.Clear();
this.listViewColumns.Show();
this.listViewColumns.Visible = true;
int intItems=0;
foreach(DataRow row in _dtReturned.Rows)
{
//Loads the Import Column and Level columns.
this.listViewColumns.Items.Add(row[0].ToString().Trim()).SubItems.Add(_TableName.ToString().Trim());
//Loads Star Column column.
this.listViewColumns.Items[intItems].SubItems.Add(row [0].ToString().ToLower().Trim());
//Load Import_Type/Size/Dec column;
string _impSzDec = row[1].ToString() + "/" + row[2].ToString() + "/" + row[4].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_impSzDec.ToString());
//Load Star Data Type Column.
this.listViewColumns.Items[intItems].SubItems.Add(row[5].ToString());
//Load Star Size column.
string _cstSz = row[2].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_cstSz.ToString());
//Load Star Decimals column.
string _cstDec = row[4].ToString();
this.listViewColumns.Items[intItems].SubItems.Add(_cstDec.ToString());
this.listViewColumns.Enabled = true;
}
Thanks
jbsys