Z
zleug
Guest
Hi All.
I populate combobox by method
public static List<Department> GetDepartments()
{
List<Department> deptdg = new List<Department>();
using (Model1 context = new Model1())
{
var departments = context.DepartmentCorps.AsNoTracking().ToList();
foreach (var dt in departments)
{
Department info = new Department();
info.DepartmentId = dt.DepartmentId;
info.Department = dt.Department;
info.Description = dt.Description;
deptdg.Add(info);
}
}
return deptdg;
}
How to insert blank first item as a result to get when form will open ComboBox will display text:
"-- Select Department --"?
Thanks
Continue reading...
I populate combobox by method
public static List<Department> GetDepartments()
{
List<Department> deptdg = new List<Department>();
using (Model1 context = new Model1())
{
var departments = context.DepartmentCorps.AsNoTracking().ToList();
foreach (var dt in departments)
{
Department info = new Department();
info.DepartmentId = dt.DepartmentId;
info.Department = dt.Department;
info.Description = dt.Description;
deptdg.Add(info);
}
}
return deptdg;
}
How to insert blank first item as a result to get when form will open ComboBox will display text:
"-- Select Department --"?
Thanks
Continue reading...