Category Archives: C# Programing

C# Programing

C Sharp DataGridView Database Operations

By | February 24, 2018

57 ViewsThe DataGridView can display data in Bound mode, unbound mode and Virtual mode . Bound mode is suitable for managing data using automatic interaction with the data store. One very common use of the DataGridView control is binding to a table in a database. Unbound mode is suitable for displaying relatively small amounts of… Read More »

Encrypt and Decrypt Using Class

By | February 19, 2018

62 Views public string DecryptString(string encrString) {     byte[] b;     string decrypted;     try     {         b = Convert.FromBase64String(encrString);         decrypted = System.Text.ASCIIEncoding.ASCII.GetString(b);     }     catch (FormatException fe)     {         decrypted = “”;     }     return decrypted; } public string EnryptString(string strEncrypted) {     byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(strEncrypted);     string encrypted = Convert.ToBase64String(b);     return encrypted; } Still The above code is not enough for me because I want to do something with my choice. Then I had implemented the code with specify charter to use in Encrypt method.

Encrypt and Decrypt with Character Choice

By | February 19, 2018

44 Viewspublic string encrypt(string encryptString) { string EncryptionKey = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”; byte[] clearBytes = Encoding.Unicode.GetBytes(encryptString); using(Aes encryptor = Aes.Create()) { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); encryptor.Key = pdb.GetBytes(32); encryptor.IV = pdb.GetBytes(16); using(MemoryStream ms = new MemoryStream()) { using(CryptoStream cs… Read More »

Encrypting & Decrypting a String in C#

By | February 19, 2018

57 Viewsusing System.IO; using System.Text; using System.Security.Cryptography; public static class EncryptionHelper { public static string Encrypt(string clearText) { string EncryptionKey = “abc123”; byte[] clearBytes = Encoding.Unicode.GetBytes(clearText); using (Aes encryptor = Aes.Create()) { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); encryptor.Key… Read More »

Sale Price Calculator

By | February 11, 2018

41 Views // Gaddis Code from text with slight mods (Wyatt) // // Terry T Trainer CIS 202 3/22/2013 /* Calculates Sale Price of Item from Price and Discount %            get price –  must Parse!       get discount % – must Parse!       calculate calculate discount       calculate sale price = price – discount       display sales price… Read More »

what is C# – Delegates

By | February 11, 2018

69 ViewsC# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. Delegates are especially used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class. Declaring… Read More »