Monday, August 22, 2011

.NET Version Checker in you PC

Here's a repost of a .NET Version Checker I found in the internet.
Code:
        const string regLocation = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";  
        static void Main(string[] args){  
        Console.WriteLine(".NET Framework versions installed");  
        Console.WriteLine("---------------------------------");  
        Console.WriteLine();  
        RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(regLocation);  
        RegistryKey tempKey;  
        if (masterKey == null)  
        {  
          Console.WriteLine("Null Key!");  
        }  
        else  
        {  
          string[] SubKeyNames = masterKey.GetSubKeyNames();  
          for (int i = 0; i < SubKeyNames.Length; i++)  
          {  
            tempKey = Registry.LocalMachine.OpenSubKey  
               (regLocation + "\\" + SubKeyNames[i]);  
            Console.Write(SubKeyNames[i]);  
            Console.WriteLine("\tVersion = {0}",   
               tempKey.GetValue("Version"));  
          }  
        }  
        Console.ReadKey();  
      }  

Reference: Check .NET Framework Version Installed

Thursday, August 11, 2011

The Error: 417 "Expectation Failed." during webrequest

Code:
System.Net.ServicePointManager.Expect100Continue = false; 

Tuesday, August 2, 2011

Date Insert In MySQL using .NET

To insert date object using C#.net in MySQL db,use the code below:
Code:
1:  string query = String.Format("Insert into tbllistings(DateRegistered)"  
2:   + "values(DATE_FORMAT({0}, '%Y-%m-%d %h:%m:%s'))",objJobs.DateRegistered); 
The key to the solution is using the MySQL Date format function.

Prevent winforms from being resized at design time

Code:
1:  this.MaximumSize = new System.DrawingSize(500, 400);  
2:  this.MinimumSize = new System.DrawingSize(500, 400);