views:

380

answers:

0

Hi!

On Form I have single select ListBox Control in which I'm displaying list of application users name and set of textboxes for displaying other selected users values. I do databinding to listbox and textboxes with the same biding source:

        usersListBox.DataSource = null;
  usersListBox.DataSource = usersBindingSource;                  
  usersListBox.DisplayMember = "Name";
  usersListBox.ValueMember = "Id";
        loginTextBox.DataBindings.Add("Text", usersBindingSource, "Login", true, DataSourceUpdateMode.OnPropertyChanged);

It works fine. Textboxes display values for selected user in listbox, but when I'm changing text in textfield SelectedIndexChanged of listBox fires with selectedIndex = 0... I discover this beacouse I want prompt user with some message box when changes are unsaved. Is this normal behaviour?