I am baffled. I have a listView (lstvBatches below) component on a form. It loads and looks just fine. But I cannot do anything with it!! I can't click a checkbox, I cannot resize columns, I cannot select various rows, I cannot even run the scrollbars. Everything is present, but nothing works.
I have included code. Not sure it will help. Also, isn't there a better way to display this code? Sorry, somewhat new to the forum.
I add columns and headers with the following code:
{
lstvBatches.Clear();int iColWidth = (lstvBatches.Width) / 3;lstvBatches.View = View.Details;lstvBatches.Columns.Add("BatchID", iColWidth - 75, HorizontalAlignment.Left);lstvBatches.Columns.Add("Date Loaded", iColWidth - 75, HorizontalAlignment.Left);lstvBatches.Columns.Add("FileName", iColWidth + 150, HorizontalAlignment.Left);lstvBatches.GridLines = true;viewBatches();
}
The viewBatches() simply calls the loading routine.
private void viewBatches()
{
//run a query and then read results.string sql = "SELECT * from UUHP_DATA.Auth_IMPLOG order by IMP_PK desc" + Environment.NewLine;OracleDataReader reader = odam.ExecuteReader(sql);if (!reader.HasRows){
MessageBox.Show("There are no records queried. Please check the sql.");return;
}int i = 0;while (reader.Read()){
//Read the basic Member Data.i++;string sPK = reader.GetValue(reader.GetOrdinal("IMP_PK")).ToString();DateTime dtDate = reader.GetDateTime(reader.GetOrdinal("IMP_DATE"));string sDate = dtDate.ToString("MM/dd/yyyy"); //Gets the date to the correct display format.string sFile = reader.GetValue(reader.GetOrdinal("IMP_FILE")).ToString();string[] arrayLine = { sPK, sDate, sFile };ListViewItem sLine = new ListViewItem(arrayLine);lstvBatches.Items.Add(sLine);}lstvBatches.View = View.Details;lstvBatches.GridLines = true;lstvBatches.CheckBoxes = true;this.Refresh();
}
Replies
Know the answer? Post it — somebody with the same question will find it here.