Delete checked items from CheckedListBox in C#

Below is a sample code that will delete checked items from a ChekcedListBox in a windows form applications. Simply call the code from a button or any other controls of your choice. for (int i = clb.Items.Count - 1; i >= 0; i--) { // clb is the name of the CheckedListBox control if (clb.GetItemChecked(i)) { clb.Items.Remove(clb.Items[i]);... » read more

Functional Programming in C++

We all know C++ as Object Oriented Programming language but just like many other widely used object-oriented languages (Java, C# etc), C++ is slowly adopting more features related to functional languages. Its default behavior is imperative but you can write code in a functional style in C++ even more easily than other pure imperative languages... » read more

How to reverse an Array in C

An array is a variable that can hold multiple values of the same data type simultaneously. Arrays are built into the core of both C and C++. It is useful when you have to declare many variables. Instead of declaring individual variables such as a0, a1, a2, … a99, you declare one array variable such... » read more

Create a Logoff/Logout Action in ASP.NET MVC

In some web environments, closing the web browser will not abandon the current user session. It’s important to create an appropriate logout/logoff action for your application for better security and privacy, especially for users that use in computers and devices. Below is the “Action” method that can be used inside your controller to kill the logged in... » read more

Replace hostname in URL using C#

Below is a function that replaces the hostname in a URL in C#. I take 2 arguments, the old and new host then returns the new host that can be pinged and browsed: public static string ReplaceHost(string originalHost, string newHost) { UriBuilder _builder = new UriBuilder(originalHost); _builder.Host = new Uri(newHost).Host; return _builder.ToString(); } Now call... » read more

Introduction to DataAdapter in .NET

What is data provider? Data Providers is a software library in .NET consisting of classes that let you connect to a data source, execute commands to access and fetch data from a data source with support to execute commands within transactions. Example of a data provider in .NET Framework is ADO.NET Data Provider. Components of... » read more

How Controllers Handle Requests in ASP.NET Core MVC?

ASP.NET Core MVC provides you with a unified web programming model through which you can create web APIs and web UI. The MVC pattern is called the design pattern. It is essentially separate from any other particular framework or language. It is a way of approaching designing a program that you can apply with any... » read more

How to Use Throw Expressions in C# 7.0

An unexpected runtime error arises in the code when an application or system constraint is being violated by the program, for example, when a program is dividing a number by zero, trying to connect to a non-existing database, or trying to open an XML file which is corrupted. We need a block of code to... » read more

What’s New in ASP.NET Core 3.0?

What is .NET Core? .NET Core is an open source, latest software development Framework by Microsoft which is used to create multiple types of applications. .NET Core is completely independent of the .NET framework and is written from scratch having different characteristics and different features. It can be used with almost all operating systems including... » read more

Create Your First C# Program

Introduction C# (pronounced as C Sharp) is an object-oriented programming language that runs on the .NET Framework. It allows developers to create robust and secure applications. Let’s talk about the basic concepts of C#. Variables: Variables are used in the program to store data. When a variable is created, it reserves a memory location to... » read more

C# Enum

In this lesson, you will learn about enum in C# with examples, and when to use them. C# Enum Enum or Enumeration is a set of integer constants that are used to assign name or string value. An example of is the days of the week, where the name can be ‘Days’, and the enumerators... » read more