I have an application that saves User Information with Image into a data base. Admin can access the information those are already saved through a different form view. Clicking on the List Box item will display the details with Image retrieved from the database.
UserViewDetails.cs:
private void lbEmp_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
if (lbEmp.SelectedIndex != -1)
{
em.Emp_ID = Convert.ToInt32(lbEmp.SelectedValue);
em.SelectById();
if (!em.EmptyPhoto)
pbEmp.BackgroundImage = em.Picture;
else
pbEmp.BackgroundImage = null;
txtEmpName.Text = em.Emp_Name;
txtImagePath.Text = em.ImgPath;
cmbEmpType.SelectedText = em.EmployeeType;
cmbCountry.SelectedValue = em.CountryID;
cmbCity.SelectedValue = em.CityID;
}
}
catch (Exception) { }
}
This form is called from the parent form Form1
:
Form1.cs:
try
{
var vi = new Admin.frmViewEmployeeInfo();
vi.ShowDialog();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Here, an "out of memory" exception is caught. What is happening? The same code doesn't throw any exception in another application of mine.