private void btnOK_Click(object sender, EventArgs e)
{
if (this.lstType.SelectedItem == null)
{
MessageBox.Show("Please select a type first!");
return;
}
this.SelectedType = this.lstType.SelectedItem as Type;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}