Posts

Showing posts with the label C#

The .Net IComparer Interface - Part 4

Image
______________________ Part one  described the sample application user experience. Part two  explained the main form engineering of the C# solution. Part three   described  the C# solution IComparer sort machinery. Part four here  will explain the C# solution data display form, and wrap up with a brief description of the differences between the C# and VB.net example applications. Download the sample C# / VB.net software  at the  GitHub repository . ________________ T he btn_load click event method btn_load_RTB_Click of CSharp_Demo_App.cs assembles and formats the display text, placing the text in variable recipe_text. Then, it declares and initializes localTextForm1, a textForm1 class instance, at line 230. This method disables the CSharp_Demo_App button controls, passes the recipe_text value to localTextForm1, and finally shows localTextForm1. CSharp_Demo_App sets the localTextForm1 recipe_text property value to recipe_text at line 235. ...

The .Net IComparer Interface - Part 2

Image
______________________ Part one  described the sample application user experience. Part two here will explain the main form engineering of the C# solution. Part three  will describe the C# solution IComparer sort machinery. Part four  will explain the C# solution data display form, and wrap up with a brief description of the differences between the C# and VB.net example applications. Download the sample C# / VB.net software  at the  GitHub repository . ________________ W e'll now look at the code-behind for main form CSharp_Demo_App.cs. The sample application opens the first form CSharp_Demo_App.cs by default, adding and configuring DataGridView object RecipeDGV to the form in the form Load event. Although a Visual Studio application can easily fill a DataGridView from a database, this application uses arrays. To handle the column headers, it first builds 2-D string array columnHeaderArray at line 49, placing the RecipeDGV column name...

The .Net IComparer Interface - Part 3

Image
______________________ Part one  described the sample application user experience. Part two  explained the main form engineering of the C# solution. Part three here will describe  the C# solution IComparer sort machinery. Part four  will explain the C# solution data display form, and wrap up with a brief description of the differences between the C# and VB.net example applications. Download the sample C# / VB.net software  at the  GitHub repository . ________________ A s Part 2  explained, the IComparer expects to sort 1-D arrays. This might seem a little restrictive, but it actually offers great flexibility. The 1-D array can hold elements of any structure or data type. Once we have a clean element type definition, we only need to customize the IComparer object to handle the element types of that 1-D array . This sample application, and Windows applications generally, can use this approach. In the application, the IComparer ob...

The .Net IComparer Interface - Part 1

Image
______________________ A  Desktop / Microsoft Windows Forms  application will probably need a way to sort the data presented to the user. If that application presents the data in a DataGridView, sorting can become quite a challenge. This article describes a solution built around the IComparer Interface, focusing on sample C# and VB.net Windows Forms applications. Note that ASP.net also handles the IComparer Interface. Part one here will describe the application user experience. Part two  will describe the main form engineering of the C# solution. Part three  will describe the C# solution IComparer sort machinery. Part four  will explain the C# solution data display form, and wrap up with a brief description of the differences between the C# and VB.net example applications. Download the sample C# / VB.net software  at the  GitHub repository . ________________ I  recently built a VB.net Windows Forms application - .NET Framework 4.5 - ...