private void TypesListBox_DoubleClick(object sender, EventArgs e) { if (visualiser == null) { visualiser = new Visualiser(); } if (TypesListBox.SelectedIndex != -1) { int type = 0; switch (TypesListBox.SelectedItem.ToString()) { case "Elevation": type = (int)ImportType.ELEV; break; case "Rainfall": type = (int)ImportType.RAIN; break; case "Temperature": type = (int)ImportType.TEMP; break; case "Drainage": type = (int)ImportType.DRAIN; break; case "Savagery": type = (int)ImportType.SAV; break; case "Volcanicity": type = (int)ImportType.VOLC; break; } try { visualiser.DisplayMap(int.Parse(xComboBox.SelectedItem.ToString()), int.Parse(yComboBox.SelectedItem.ToString()), type, gennedTypes); } catch (ObjectDisposedException ex) //This is a really aroundabout way of doing it, but I can't figure out how to stop it opening more than once { visualiser = new Visualiser(); visualiser.DisplayMap(int.Parse(xComboBox.SelectedItem.ToString()), int.Parse(yComboBox.SelectedItem.ToString()), type, gennedTypes); } } }