C# Encryption and Decryption by Rijndael Method

Another flawlessly written program to up your C# skills! The code is written and tested in Visual Studio 2012. Features of this project are:


  • Encrypt and Decrypt any type of file/s in your computer system.
  • Easy to use interface. Few clicks required only.
  • Choose passkey also known as a password. May consist of letters and numbers[Maximum 8]. 
  • Keep original files intact. You may change code to delete original files but we did not implement this currently. 
  • A class with functions to encrypt and decrypt files is created. This file may be reused.
  • The Rijndael algorithm of Encryption and Decryption is used internally to Cipher & Decipher. 
C# Encryption Decryption


C# 3 X 3 TicTacToe Tutorial


You can find the code to the popular game TicTacToe in C# language using the .Net Framework 4.5. The highlights include the following:
  • Perfectly Written Flawless Code in .Net Framework C# 5 language using WinForms
  • Programmer level only Beginner required. NOT Intermediate. NOT Expert. 
  • The code is explained immediately before being written. 
  • The game's basic functionality is that it has two players put their letters, the X and O in 9 available grid boxes one by one and the player to make a straight line with 3 letters wins. 
  • The Game Counts scores of the individual players and a Reset of the scores is also possible. 
  • Players may reset the current game and start a new game whenever needed. 
  • Please recommend and comment if it worked for you. Thank You for Visiting :) 

Cubic Equation Roots in C# Code


  • The program below perfectly solves the Cubic Equation of the form Ax^3 + Bx^2 + Cx + D.
  • The flawless code is written in .Net C#.
  • The real and imaginary roots are separated by black and red colors respectively.
  • Simply update the value of variables A, B, C and D to see the answers i.e. the solution of the equation. 
  • To find the 2 roots, solution of a Quadratic equation please visit here.
  • This code is written by Code-Kings exclusively for YOU! Please like us wherever possible and show some love in return!


Download File from Internet Synchronously and Asynchronously



This program will let you download a file both ways i.e. Synchronously and Asynchronously. Just feed the file URL into the first text-box and the save file location into the second text-box  Then simply choose from the two options to download the file from the internet. 

Measure Difference between 2 Dates


Getting differences between two given dates is as easy as it can get. The function used here is the End_Date.Subtract(Start_Date). This gives us a time span that has the time interval between the two dates. The time span can return values in the form of days, years, etc.

Solve Quadratic Equation Code and Tutorial in C#


You can very easily solve a Quadratic Equation with this small program. Just enter the values in the 3 text boxes and you will find the resulting roots(solutions) of the Quadratic equation on the right. Watch the final output and see the source code further below: 

Solve Quadratic Equation in C# WinForms Application

The C# Code below is simple, structured & complete. Note the code for the text box change event is similar for all the 3 text boxes. 

Show and Invert RGB Colors in C#


This post will demonstrate how to show and convert colors when the Red Green & Blue values of those colors are given. We simple use a function and supply the Red, Green and Blue components in the parameter list. We shall also see how to Invert a color. In the image below the text color is set by the user. The background color is automatically set which is the Invert of the Text color. See image below to have a look at the final output of our WinForms application:



Named Arguments in .Net C#


Named Arguments are an alternative way for specifying parameter values in function calls. They work so that the position of the parameters would not pose problems. Therefore it reduces the headache of remembering the positions of all parameters for a function. It also helps to avoid the excess overloading of functions that contain less or more of the same set of parameters. 

They work in a very simple way. When we call a function, we would write the name of the parameter before specifying a value for the parameter. In this way, the position of the argument will not matter as the compiler would tally the name of the parameter against the parameter value. This makes it unnecessary to remember the organisation of the parameters in the function definition. 


Optional Parameters in .Net

Optional Arguments were introduced in C# 4.0 and this article will show you how to use them. Optional Arguments are necessary when you specify functions that have a large number of arguments. It can cut down time by making you pass on argument values to the most needy parameters in a situation. 

Optional Arguments are what their name suggests i.e. even if you do not specify them, its perfectly OK. But it doesn't mean that they have not taken a value. In fact we specify some default values that the Optional Parameters take when values are not supplied in the function call. In this way we gain the functionality of easily setting values once and using these values several times as a default unless something different is needed. 

Printing a Windows Form to Printer and File in C#


The objective here is to print a Windows Form to the Printer or a File on the HDD. You can also have a Print Preview before you print a WinForm. See the Form below that we shall print. We will encounter one small problem i.e. the button, radio buttton and textbox are not required for printing. We only wish to print the written text written above in Green color. There is VS 2012 source code at the very end. See the code and explanations below the image:

Display all Files and Folders in a Directory in C#


You can easily list and display all the files and folders in a C# application using the DirectoryInfo class. First have a look at the application screenshot which uses this class to display the Files and Folders in a specified directory. All the Files and Folders are displayed in a ListView