Posts

Enable mouse scroll-wheel in VB6

VB6 would let us use the mouse scroll-wheel like later versions of VS does. Here's a add-in for VB6 that I have used that does just that! Download  \ Visual Basic 6\vb6mousewheel\VB6MOU~1   from Microsoft web site ·          Copy the VB6IDEMouseWheelAddin.dll to somewhere on your local machine where it won’t get deleted. I use “C:\Program Files\Microsoft Visual Studio 6”. ·          Click Start, click Run, type regsvr32 \VB6IDEMouseWheelAddin.dll, and then click OK. ·          Start Visual Basic 6.0. ·          Click Add-Ins, and then click Add-in Manager. ·          In the Add-in Manager list, click MouseWheel Fix. ·          Click to select the Loaded/Unloaded check box, and then click to select the Load on Startup...

Online C++ Compiler

Please find the Online Compiler for running C++ and other different programs: http://codepad.org . Below is the sample template code for C++: #include using namespace std; int  main() {  char str[10];  sprintf(str,"%3d%2d",311,12);  cout<  cout<  return 0; }

Optimal Enum to String Convertion

public static String ConvertToString( this Enum eff) {      return Enum .GetName(eff.GetType(), eff); }

Filling, Fetching and Removing HttpRuntime.Cache

public static void FillCache(string strCacheKey, object cacheObject) {     HttpRuntime.Cache.Insert(strCacheKey, cacheObject, null, DateTime.MaxValue, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, null); } public static object GetCache(string cacheKey) {     object cacheObject = null;     if (HttpRuntime.Cache[cacheKey] != null)     {         cacheObject = HttpRuntime.Cache[cacheKey];     }     return cacheObject; } public static bool RemoveCache(string cacheKey) {     bool isRemoved = false;     if (HttpRuntime.Cache[cacheKey] != null)     {         HttpRuntime.Cache.Remove(cacheKey);         isRemoved = true;     }     return isRemoved; }

Using StackFrame Class to get the stack information

using System.Diagnostics; ... //Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable. public static int GetFileLineNumber() {     StackFrame s = new StackFrame(1, true);     return s.GetFileLineNumber(); } //Gets the method in which the frame is executing. public static string GetMethod() {     StackFrame s = new StackFrame(1, true);     return s.GetMethod().Name; } //Gets the file name that contains the code that is executing. This information is typically extracted from the debugging symbols for the executable. public static string GetFileName() {     StackFrame s = new StackFrame(1, true);     return s.GetFileName(); } Read: http://msdn.microsoft.com/en-us/library/system.diagnostics.stackframe.aspx

Serializing and Deserializing Object using XmlSerializer

public static string SerializeObject (T value) {     if (value == null)     {         return null;     }     XmlSerializer serializer = new XmlSerializer(typeof(T));     XmlWriterSettings settings = new XmlWriterSettings();     settings.Encoding = new UnicodeEncoding(false, false);     settings.Indent = false;     settings.OmitXmlDeclaration = false;     using (StringWriter textWriter = new StringWriter())     {         using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings))         {             serializer.Serialize(xmlWriter, value);         }         return textWriter.ToString();   ...

Server.GetLastError that occurred

Exception ex= Server.GetLastError(); string error = ex.Message;