Skip to content
Advertisement

C# DatagridView fill with class SingleResponsibility

Hi StackOverflow members, I decided to build a library project to improve myself. I created a class to code Book Operations but i couldn’t find out how to fill datagrid via class method. When i text this method into a button action it didn’t work. I found out a solution to make it happen. And here’s some code from my BookOperation class;

Yönetici is the name of my application screen of book operations. In the button action, it includes;

is it okay for single responsibility or is there any different way? Can you please help me? That’s kind of weird using somemethod(this), is it wrong or good for a start? what do you think. How can i get data without using (this)? If there’s a way, can you hit it?

Advertisement

Answer

I suggest you to change your method parameters and return type with what you need. It seems your queries need just 1 criteria.

So you won’t need all the Yonetici page on your data access layer and with returned DataTable, you can bind it to your gridview on presentation layer.

Part 2

Usage

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement