Hexadecimal to Integer (vice versa)
Feb 26th
/// <summary> /// Hexa decimal to String /// </summary> /// <param name="HexString">hexa decimal string</param> /// <returns>int</returns> public static int HexToInteger(string HexString) { return int.Parse(HexString, System.Globalization.NumberStyles.HexNumber); } /// <summary> /// Integer to Hexa decimal string /// </summary> /// <param name="IntValue">int</param> /// <returns>hexa decimal string</returns> public static string IntegerToHex(int IntValue) { return IntValue.ToString("X"); }
Hexadecimal string to Bytes array
Feb 26th
/// <summary> /// Hexa decimal to Byte array /// </summary> /// <param name="HexString">Hexa decimal string</param> /// <returns>byte array</returns> public static byte[] HexToBytes(String hexString) { byte[] byteArray = null; int byteCount = 0; if (hexString != null && hexString.Length > 0) { // make sure we have an even number of characters if (hexString.Length % 2 [...]
Bytes array to Hexadecimal string
Feb 26th
/// <summary> /// Byte array to Hexa decimal string /// </summary> /// <param name="bytes">byte array</param> /// <returns>hexa decimal string</returns> public static string BytesToHex(byte[] bytes) { string hex = BitConverter.ToString(bytes); return hex.Replace("-", ""); } /// <summary> /// Byte array to Hexa decimal string /// </summary> /// <param name="bytes">byte array</param> /// <param name="includeHyphen">bool include hyphen</param> /// <returns>hexa [...]
Find the balance amount (sum(credit) – sum(debit)) from the following table?
Feb 24th
Ans: find out the balance amount of account no: 1 select a.SumCr as Credit , b.SumDr as Debit , a.SumCr – b.SumDr as Balance from ( select sum(A_Amount) as SumCr from tblAccount where A_ID = 1 and A_Type = ‘Cr’ ) a , ( select sum(A_Amount) as SumDr from tblAccount where A_ID = 1 and [...]
Find out the N’th maxium salary?
Feb 24th
Ans: find the 5th maxium salary: 1: SELECT TOP 1 * FROM tblEmployee WHERE E_Salary NOT IN 2: (SELECT DISTINCT TOP 4 E_Salary FROM tblEmployee ORDER BY E_Salary DESC) 3: ORDER BY E_Salary DESC
Auto Complete ComboBox – VB.NET Windows Forms
Feb 24th
Download source files – 17.6 Kb Download demo project – 9.08 Kb Introduction This is a simple code snippet which is used to make an Auto Complete ComboBox. Using the code Usage: Call the subroutine from within the ComboBox’s KeyPress event handler. AutoComplete(ByRef cb As ComboBox, ByVal e As System.Windows.Forms.KeyPressEventArgs, Optional ByVal blnLimitToList As Boolean [...]
Auto Complete ComboBox – C# Windows Forms
Feb 24th
Download source files – 8.50 Kb Download demo project – 11.0 Kb Introduction This is a simple code snippet which is used to make an Auto Complete ComboBox. Using the code Usage: Call the function AutoComplete from within the ComboBox’s KeyPress event handler. AutoComplete(ComboBox cb, System.Windows.Forms.KeyPressEventArgs e, bool blnLimitToList) Code /// <summary> /// AutoComplete /// [...]
DataGrid Paging using DataReader – C# Windows Forms
Feb 24th
Download source files – 21.5 Kb Download demo project – 8.0 Kb Introduction This is an example of Windows Forms DataGrid paging using c#. I have used Microsoft SQL Server 2000 database. Using the code Create a table: create table tblEmp ( E_ID int primary key , E_Name varchar(60) , E_Salary money , E_DOJ datetime [...]
DataGrid Paging – C# Windows Forms
Feb 24th
Download source files – 16.5 Kb Download demo project – 8.0 Kb Introduction This is an example of Windows Forms DataGrid paging using c#. I have used Microsoft SQL Server 2000 database. Using the code Create a table: create table tblEmp ( E_ID int primary key , E_Name varchar(60) , E_Salary money , E_DOJ datetime [...]
Storing and retrieving Images from Access database using VB.Net
Feb 24th
Download source files (38.52 kb) Download demo project (52.11 Kb) Introduction This is a simple code snippet which is used to store and retrieve images from Access database using VB.net. Code Private Sub ShowDetails() Try Dim cn As New OleDb.OleDbConnection Dim cmd As OleDb.OleDbCommand Dim dr As OleDb.OleDbDataReader cn.ConnectionString = mstrConnection cn.Open() cmd = [...]
