Let's have a look at the rest of the code in the ImportBooks form. The form load just populates the storage spaces list, if any existing storage spaces have been previously saved:
private void ImportBooks_Load(object sender, EventArgs e) { PopulateStorageSpacesList(); if (dlVirtualStorageSpaces.Items.Count == 0) { dlVirtualStorageSpaces.Items.Add("<create new storage space>"); } lblEbookCount.Text = ""; }
We now need to add the logic for changing the selected storage space. The SelectedIndexChanged() event of the dlVirtualStorageSpaces control is modified as follows:
private void dlVirtualStorageSpaces_SelectedIndexChanged(object sender, EventArgs e) { int selectedValue = dlVirtualStorageSpaces.SelectedValue.ToString().ToInt(); ...