T
Tariq
Hi,
I have a list box that is bound to an arraylist, but when the data
changes the listbox does not refresh.
-----------------------------------------------------------------------------
al = new ArrayList();
al.Add("1");al.Add("2");al.Add("3");al.Add("4");al.Add("5");al.Add("6");
listBox1.DataSource = al;
label1.Text = al.Count.ToString();
----
Data source changes
private void button1_Click(object sender, System.EventArgs e)
{
al.Remove(listBox1.SelectedItem.ToString());
label1.Text = al.Count.ToString();
listBox1.Update();
}
-----------------------------------------------------------------------------
Unfortunately I have to resort to setting listbox.DataSource = null;
and listbox.DataSource = al; for the listbox to refresh.
Am I missing something|?
- Tariq
I have a list box that is bound to an arraylist, but when the data
changes the listbox does not refresh.
-----------------------------------------------------------------------------
al = new ArrayList();
al.Add("1");al.Add("2");al.Add("3");al.Add("4");al.Add("5");al.Add("6");
listBox1.DataSource = al;
label1.Text = al.Count.ToString();
----
Data source changes
private void button1_Click(object sender, System.EventArgs e)
{
al.Remove(listBox1.SelectedItem.ToString());
label1.Text = al.Count.ToString();
listBox1.Update();
}
-----------------------------------------------------------------------------
Unfortunately I have to resort to setting listbox.DataSource = null;
and listbox.DataSource = al; for the listbox to refresh.
Am I missing something|?
- Tariq