Posted by Pharaoh on October 19, 2010 ·
be sure to use the following namespace
using System.Net;
we will create a method that sends out machine name and ip address as output parameters
void getMachineInfo(out string MachineName, out string IPAddress)
{
MachineName= Dns.GetHostName();
IPHostEntry iphostentry = Dns.GetHostByName(MachineName);
IPAddress = iphostentry.AddressList[0].ToString();
}
you wanna call the method like :
string [...]
Posted by Pharaoh on October 18, 2010 ·
Unfortunately datagridview does not support gradient columns header , there’s a work around it : first thing we need to do is to handle the CellPainting Event of the Datagridview .
put this segment of code on the top of code page of the Form
//to use brushes , and graphics
using System.Drawing;
using System.Drawing.Drawing2D;
in the CellPainting Event of the datagridview post the following [...]
Posted by Pharaoh on October 12, 2010 ·
Introduction ..
in order to connect to any data source you will often need some information about that source , such as it’s location and it’s way of connectivity .
also you will be needing a tool to connect and disconnect from that data source
ADO.Net Connection Class ..
ADO.Net encapsulate all of the data source connectivity in one class called ”Connection” , according [...]
Posted by Pharaoh on October 12, 2010 ·
Instead of saving passwords in a plain text format in the database it’s better hashing them one thing to consider is hashing is not encrypting which means once you hashed the password you will never see the original one (theoretically)
for example if you hash the word “Pharaoh” using MD5 you will get “……………..”
now all we need to do is to [...]
Posted by Pharaoh on October 11, 2010 ·
Introduction … !
using SqlDataSource With the GridView Control gives you a lot of advantages , on the other hand if you are an old school ADO/ADO.Net programmer you would encounter scenarios where you wanna bind your gridview with your own datatable . the most obvious problem you will encounter that after binding the datatable with gridview and set AllowPaging = true and try to navigate between [...]
Posted by Pharaoh on October 11, 2010 ·
Ternary Operators ….
Basically ternary operators are just an inline if statements ..
Consider the following Pseudo code segment
bool isAdmin = getUserStatus();
string outPutMessage = "";
if (isAdmin)
{
outPutMessage = "You Are An Administrator";
}
else
{
outPutMessage = "You Are A Normal User";
}
MessageBox.Show(outPutMessage);
Assuming that getUserStatus() is a Method that returns a boolean [...]
Posted by Pharaoh on October 3, 2010 ·
Introduction ..
As a Developer it’s one of my daily tasks to perform database operations such as read data from database and update data back to the database and handle all sorts of data manipulation operations such as searching and exporting sets of data into another formats , etc .
What’s ADO.Net .. ?
ADO.Net is a rich set of Classes Provided Within Microsoft’s .Net to Handle [...]