In C#, a constant is a value that cannot be modified after it is declared. Constants are typically used for values that will not change throughout the execution of a program, such as mathematical constants or other unchanging...
Tag - C# Tutorial
C# Variables with Examples
In C#, a variable is a storage location for a value that can be of a specific type. A variable is declared with a name and a type, and it can be assigned a value of that type. Here is an example of declaring and using variables...
How to Set a Button Background as an Image in C#
The Image property of a Button control is used to set a button background as an image. The Image property needs an Image object. The Image class has a static method called FromFile that takes an image file name with full path and...
How to Change Background and Foreground Color of a Button Control in C#
BackColor and ForeColor properties are used to set background and foreground color of a Button respectively. If you click on these properties in Properties window, the Color Dialog pops up. Alternatively, you can set background...
How To Add Newline in a TextBox control in C#
In this tutorial, we’ll learn How to add newline in a TextBox Control. Normally, when you want to add newline to a string you can use’\n’ for adding new lines like below. Example: C# using System; using System...
TextBox Control in C# with Examples
In this tutorial, you will learn about essential control in the WinForms application world, which is the TextBox Control. A TextBox is widely used in Windows Application, mainly to get or set data from/to a data source. Just like...
Change FontSize of DataGridView Columns in C#
In this tutorial,i’ll show you How to change font size in DataGridView. Solution 1: Design-time In winform datagrid, right click to view its properties. It has a property called DefaultCellStyle. Click the ellipsis on...
Overloading in C# with Examples
In overloading, there are multiple methods with different method signatures. Below are some examples that show how we can achieve overloading by varying the number of parameters, the order of parameters, and data types of...
How to Insert Elements at a Position in a C# List?
The Insert method of List class inserts an object at a given position. The first parameter of the method is the 0th based index in the List. The InsertRange method can insert a collection at the given position. Add an item...
List Collection in C#
In c#, List is a generic type of collection, so it will allow storing only strongly typed objects, i.e., elements of the same data type. The size of the list will vary dynamically based on our application requirements, like...