in Program.cs I add this code:
- services.AddDbContext
(context => context.UseSqlServer(constr)); - services.AddScoped
(); - services.AddScoped
();
in MDIForm I add this code:
- private readonly IClassService classService;
- private readonly ICategoryService categoryService;
- public MdiForm(IClassificationService classificationService, ICategoryService categoryService){
- this.classService = classService;
- this.categoryService = categoryService;}
then to show a category from MDI I do this code. But in order to add the classService from CategoryForm to Classification, it should be a part of CategoryForm.
from MDI Form to show CategoryForm:
- var categoryForm = new frmCategory(classService, categoryService);
- categoryForm.ShowDialog();
- from CategoryForm to show ClassForm:
- var classForm = new frmClass(classService);
- classForm .ShowDialog();
Mario ScheerenPosted Mar 8, 2021, 5:31 AM
Geni LouPosted Mar 8, 2021, 4:34 AM
Mario ScheerenPosted Mar 2, 2021, 6:29 PM