Category: C#
How to use php mcrypt_encrypt with C# chilkat decrypt
By admin on May 13, 2008 | In PHP, C# | Send feedback »
I recently came across a situation where I needed to encrypt a string in PHP using blowfish and then decrypt later using C# (please note I use the excellent chilkat .net component for decryption).
The PHP encryption bit is below (make sure you use PHP… more »
Load an html page and print it using c#
By admin on Apr 4, 2008 | In C# | Send feedback »
To use the this code you need to right click on your tool box and click to add the com component called Microsoft web browser first!
private void button(object sender, EventArgs e)
{
//when the button is pressed the page is loaded… more »
Get selected Cell content from datagridview in C#
By admin on Apr 1, 2008 | In C# | Send feedback »
To get the content of the selected text simply add the following line in your single click event:
datagridview1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
or if you want a specific cell to always be selected simply add the index of that… more »
C# connect to SQL express and retrieve a set of data
By admin on Apr 1, 2008 | In C#, SQL SERVER & SQL EXPRESS | Send feedback »
try
{
SqlDataReader thisReader;
SqlConnection thisConnection = new SqlConnection("Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=yourdatabase;Integrated Security=True;");… more »
Convert String to a float variable using C#
By admin on Mar 31, 2008 | In C# | Send feedback »
float myfloat = float)System.Convert.ToSingle("99.16"); more »
Read text file and retun it as one string in C#
By admin on Mar 31, 2008 | In C# | Send feedback »
public string readTextFile(string filename){
//loads a text file and returns the string
System.IO.StreamReader file = new System.IO.StreamReader(@"\"+filename);
string test = file.ReadToEnd();
return te… more »
Save a text file in C#
By admin on Mar 31, 2008 | In C# | Send feedback »
using System.Text;
using System.IO;
public void saveTetFile(String filename, String filecontent)
{
//saves a text file
TextWriter tw = new StreamWriter(filename);
// write a line of text to the… more »