private void btnSearchResource_Click(object sender, EventArgs e) { try { if (txtResourceIdEntry.Text == string.Empty) { MessageBox.Show("ResourceID is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { ResourceBL resourceBL = new ResourceBL(); r = resourceBL.GetResource(Convert.ToInt32(txtResourceIdEntry.Text)); txtResourceTitle.Text = r.Title; txtResourceType.Text = r.ResourceType.ToString(); txtResourceStatus.Text = r.ResourceStatus.ToString(); chkIsReserved.Checked = r.IsReserved; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }