private void AddEditItem_Load(object sender, EventArgs e)
{
LoadPriorityAndStatus();
if (!IsNewItem)
{
if (null == Item)
{
MessageBox.Show("Item property cannot be null when editing an Item", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
this.Close();
return;
}
textBoxName.Text = Item.Name;
textBoxDescription.Text = Item.Description;
if (null != Item.Priority)
{
comboBoxPriority.SelectedIndex = Item.Priority.Value - 1;
}
if (null != Item.Status)
{
comboBoxStatus.SelectedIndex = Item.Status.Value - 1;
}
}
}