private void ImportData() { // Loading data into the form try { if (ComboLocation.SelectedIndex < 0) { return; } using (var dc = new DBAuditDataContext()) { string strName = null; int? intSectorId = null; string strNotes = null; dc.ProSelectLocation(int.Parse(ComboLocation.SelectedValue.ToString()), ref strName, ref intSectorId, ref strNotes); TxtName.Text = strName; ComboSectors.SelectedValue = intSectorId; TxtNotes.Text = strNotes; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }