g_r_a_robinson
Regular
- Joined
- Jan 13, 2004
- Messages
- 71
I have two listboxes (dualselectlistbox) what I need to do is be able to tell what changes have been made between the two. For eg, I have returned three people in the available and two people in the selected. I then move another into the available making 2 available 3 selected.
I have an ArrayList that contains the people in the available. I simply deduct that figure from the available so all the user see is five users in all. Just before submitting the update I iterate again through the available list box and pass the result to another ArrayList.
I've gotten this far and I'm surprised even at that, but now i'm a bit unsure what to do next. I know I need to compare the initial Arraylist with the new one with any possible additions and removals. I then need to get the result into a stringbuilder (I'm assuming that more than one user could have been added or removed).
Anyone done this. I've posted some code:
Theres two of these. One iterates before and another iterates after. They both iterate through the available list only.
<code>
if (DualSelectListBox1.SelectedListBox.Items != null)
{
for (int i = 0; i <= DualSelectListBox1.SelectedListBox.Items.Count -1; i++)
{
ListItem item = DualSelectListBox1.SelectedListBox.Items;
assignedUserID = Int32.Parse(item.Value);
if (assignedUserID == User_ByWho)
{
checkForDuplicate = "IsDuplicated";
}
GetListBeforeUpdating.Add(assignedUserID);
IEnumerator E = arraylist.GetEnumerator();
E.MoveNext();
}
if (checkForDuplicate == null)
{
GetListBeforeUpdating.Add(User_ByWho);
}
}
</code>
I have an ArrayList that contains the people in the available. I simply deduct that figure from the available so all the user see is five users in all. Just before submitting the update I iterate again through the available list box and pass the result to another ArrayList.
I've gotten this far and I'm surprised even at that, but now i'm a bit unsure what to do next. I know I need to compare the initial Arraylist with the new one with any possible additions and removals. I then need to get the result into a stringbuilder (I'm assuming that more than one user could have been added or removed).
Anyone done this. I've posted some code:
Theres two of these. One iterates before and another iterates after. They both iterate through the available list only.
<code>
if (DualSelectListBox1.SelectedListBox.Items != null)
{
for (int i = 0; i <= DualSelectListBox1.SelectedListBox.Items.Count -1; i++)
{
ListItem item = DualSelectListBox1.SelectedListBox.Items;
assignedUserID = Int32.Parse(item.Value);
if (assignedUserID == User_ByWho)
{
checkForDuplicate = "IsDuplicated";
}
GetListBeforeUpdating.Add(assignedUserID);
IEnumerator E = arraylist.GetEnumerator();
E.MoveNext();
}
if (checkForDuplicate == null)
{
GetListBeforeUpdating.Add(User_ByWho);
}
}
</code>