Note that there are some explanatory texts on larger screens.

plurals
  1. POListbox clears all items during datasource change
    text
    copied!<p>When I change the datasource of my Listbox all items are cleared, when loading new data into this Listbox it stays clear. I have another ListBox right new to this one with the same refresh code but that one refreshes perfectly.</p> <pre><code> private void RefreshContacts() { this.ListContacts.DataSource = null; this.ListContacts.DataSource = this.contacts; this.BoxCountContacts.Text = this.ListContacts.Items.Count.ToString(); } </code></pre> <p>Anyone have an idea how to fix the listbox from being cleared and bugged?</p> <p>Here is the full refresh codes of the two listboxes</p> <pre><code> private Contact[] contacts, feed; private Boolean isFeed; internal ArcFeed() { this.InitializeComponent(); this.contacts = this.feed = new Contact[0]; } private void RefreshForm(Boolean isFeed) { if (isFeed) { this.RefreshFeed(); } else { this.RefreshContacts(); } } private void RefreshContacts() { this.ListContacts.DataSource = null; this.ListContacts.DataSource = this.contacts; this.BoxCountContacts.Text = this.ListContacts.Items.Count.ToString(); } private void RefreshFeed() { this.ListFeed.DataSource = null; this.ListFeed.DataSource = this.feed; this.BoxCountFeed.Text = this.ListFeed.Items.Count.ToString(); } private void OpenFile() { if (this.isFeed) { this.BoxFileFeed.Text = this.DialogOpen.FileName; this.feed = ArcBuzz.Load(this.DialogOpen.FileName); } else { this.BoxFileContacts.Text = this.DialogOpen.FileName; this.contacts = ArcBuzz.Load(this.DialogOpen.FileName); } this.RefreshForm(this.isFeed); } </code></pre> <p>All code is debugged and follows it's course properly, I don't see any errors, the correct listbox's datasource are set and changed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload