ok so i am using an arraylist
CODE
ArrayList name = new ArrayList();
let me set this up for you:
I have two list boxes
Box 1 (add/remove buttons) Box 2
the first list box contains 238 countries - the countries in list box 2. The second List box contains Countries that the user decided they did not want information about.
What needs to happen:
Upon click of the Remove button(removes country from List box 2)
i need to store the country name that was removed in an ArrayList
Problem:
name keeps getting reset to count = 0.
Code that i can show:
CODE
public partial class classname : Inherited
{
SqlConnection conn = null;
int count = 0;
String country = "none";
ArrayList name = new ArrayList(); //setup of the arraylist
CODE
protected void btnRemove_Click(object sender, EventArgs e)
{
foreach (int j in listbox2.GetSelectedIndices())
{
ListItem movecountry = new ListItem();
movecountry.Value = listbox2.Items[j].Value;
movecountry.Text = listbox2.Items[j].Text;
listbox1.Items.Add(movecountry);
name.Add(listbox2.Items[j].Text);
listbox2.Items.Remove(movecountry);
}
This post has been edited by rgfirefly24: 28 May, 2008 - 11:28 AM