Friday, August 28, 2009

How to Change Font-Size, Font-Family,Font-Style at RunTime

Label lblCarrier = new Label();

lblCarrier.Text = "Carrier Name:"
lblCarrier.AutoSize = true;
Font font = new Font("Arial", 9, FontStyle.Bold);
lblCarrier.Font = font;

Hope this helps :-)

Thursday, August 27, 2009

Visual Studio 2010 and .NET Framework 4 Beta 1 Are Here

Check out Visual Studio 2010 and the .NET Framework 4 Beta 1 for the next generation of developer tools from Microsoft.

View article...

Windows 7 Training Kit for Developers Now Available

Download the new Windows 7 Training Kit for Developers. The kit includes code, videos, and labs for both native Win32 C++ developers and .NET developers covering the new features available in Windows 7.

Click here for more Info...

Wednesday, August 05, 2009

Get Process Status using C#

The following code snippet can be used to get the status of any process or an application given its name or PID (Process ID).

using System.Diagnostics;
private void GetProcessStatus()
{
try
{
//If you know the name of the process
Process[] myProcess = Process.GetProcessesByName("notepad");
//If you know the PID of the process use the commented line below
//Process[] myProcess = Process.GetProcessById("1983");
//Check to see if the process array length is greater than 0
if(myProcess.Length > 0)
{
MessageBox.Show("The Process Notepad is currently running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("The Process Notepad is currently not running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch(Exception ex)
{
MessageBox.Show("An Exception Occoured: " + ex.Message, "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

Monday, July 27, 2009

What is AutoEventWireup?

ASP.NET page framework also supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true (or if it is missing, since by default it is true), the page framework calls page events automatically, specifically the Page_Init and Page_Load methods. In that case, no explicit Handles clause or delegate is needed.

The disadvantage of the AutoEventWireup attribute is that it requires that the page event handlers have specific, predictable names. This limits your flexibility in how you name your event handlers. Therefore, in Visual Studio, the AutoEventWireup attribute is set to false by default and the designer generates explicit code to bind page events to methods.

If you do set AutoEventWireup to true, Visual Studio will generate code to bind the events and the page framework will automatically call events based on their names. This can result in the same event code being called twice when the page runs. As a consequence, you should always leave AutoEventWireup set to false when working in Visual Studio.

For more information Click here