private void PopulateUnits() { try { DAL.UnitsInfo objUnit = new DAL.UnitsInfo(); objUnit.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString; DataTable dt = objUnit.getRecord(string.Empty); if (dt.Rows.Count > 0) { cboUnit.DataSource = dt; cboUnit.DisplayMember = "UnitTitle"; cboUnit.ValueMember = "UnitID"; } } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }