Can we create the attached model like datagridview in C#.net Windows Form Application.

muralee raman 0 Reputation points
2024-06-19T05:42:33.01+00:00

We are planning a desktop application using c#.net. One of our challenges is to create an attached type of DataGridView.Unfortunately, we are not getting any solution for designing customized types of DataGridView.If possible above type of DataGridView in Windows form application provides a better solution. If not possible provide any other solution for that. Here is the attached DataGridView

GridSp

Developer technologies | Windows Forms
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | .NET | Other
Developer technologies | VB
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,596 Reputation points Volunteer Moderator
    2024-06-19T13:19:16.72+00:00

    Best solution for strong typed data is using EF Core, BindingSource and BindingList (that allows sorting). Next would be to use Dapper, BindingSource and BindingList (that allows sorting).

    The following is done with EF Core but could had been done with Dapper.

    https://github.com/karenpayneoregon/ef-code-8-samples/tree/master/NorthWind2024StarterApp

    As it is a code sample for getting started there are things that need attention but works as is.

    Notes

    • Uses a ComboBox is the DataGridView for Countries
    • Uses a custom BindingNavigator (newer releases of .NET do not expose this)
    • Uses a customer BindingList for sorting data
    • Uses NuGet package FluentValidation for validation
    • Uses BindingList.ListChanged event to get at changes in the DataGridView
    • Avoids touching the DataGridView to get at data.

    master

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.