Hi,
I have a list view which is placed on a tab control. It loads during form initialization. It will list all registered eai items.
I can select an LV item and unregister it. It clears entry from table and then it re-loads the list view. But it doesn't reflect in ui.
I have tried listview.Refresh() and .Removeat(), Listview.Update() But nothing worked. Any idea how to refresh list view??
Here is the code sample:
public void LoadEAIPlugins()
{
try
lstVwEAIPlugins.Items.Clear();
for (int i = 1, iteratorTest = g_swServer.m_EAIPluginsInDB.Count; i
<= iteratorTest; i++)
{
objEAIPlugin = g_swServer.m_EAIPluginsInDB[i];
AddToGrid2(lstVwEAIPlugins, objEAIPlugin.EAIType,
objEAIPlugin.FileNameInDB, objEAIPlugin.InitParams,
objEAIPlugin.FileFoundOnDrive);
lstVwEAIPlugins.Update();
}
lstVwEAIPlugins.Update();
}
private void AddToGrid2(ListView lstVw, string sText, string sSubItem1, string sSubItem2, bool bStatus)
{
ListViewItem lstItem = (ListViewItem)lstVw.Items.Add(sText);
lstItem.ForeColor = Color.Black; //Normal
if (!bStatus)
{
ListViewHelper.GetListViewSubItem(lstItem, 3).Text = "FAIL";
lstItem.ForeColor = Color.Red; //Red
}
else
{
ListViewHelper.GetListViewSubItem(lstItem, 3).Text = "OK";
}
ListViewHelper.GetListViewSubItem(lstItem, 1).Text = sSubItem1;
ListViewHelper.GetListViewSubItem(lstItem, 2).Text = sSubItem2;
}