private void buttonOk_Click(object sender, EventArgs e)
 {
     if (listBoxSelect.SelectedItem == null)
     {
         DialogResult = DialogResult.None;
         MessageBox.Show("Ничего не выбрано!");
     }
     else
     {
         SelectedItem = (SelectObject)listBoxSelect.SelectedItem;
     }
 }
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (listBoxSelect.SelectedItem == null)
     {
         DialogResult = DialogResult.None;
         MessageBox.Show("Ничего не выбрано!");
     }
     else
     {
         SelectedItem = (SelectObject)listBoxSelect.SelectedItem;
     }
 }