fix the selection jumping bug

This commit is contained in:
Tim Young 2018-10-01 15:10:51 -05:00
parent b7f7a6b9ae
commit 481ddc0121

View File

@ -261,6 +261,8 @@ namespace EduNetworkBuilder
{
int selectedIndex = lbWindowData.SelectedIndex;
string selected = "";
int topmost = lbWindowData.TopIndex;
int totalcount = lbWindowData.Items.Count;
if (lbWindowData.SelectedIndex != -1)
selected = lbWindowData.Items[lbWindowData.SelectedIndex].ToString();
lbWindowData.Items.Clear();
@ -382,7 +384,10 @@ namespace EduNetworkBuilder
if(selected != null && selected != "")
{
if (selectedIndex >= 0 && selectedIndex < lbWindowData.Items.Count)
{
lbWindowData.SelectedIndex = selectedIndex;
lbWindowData.TopIndex = topmost;
}
}
if(lbWindowData.SelectedIndex != -1)
{
@ -455,7 +460,10 @@ namespace EduNetworkBuilder
if (selected != null && selected != "")
{
if (selectedIndex >= 0 && selectedIndex < lbWindowData.Items.Count)
{
lbWindowData.SelectedIndex = selectedIndex;
lbWindowData.TopIndex = topmost;
}
}
if (lbWindowData.SelectedIndex != -1)
{