Archive for the ‘.net’ Category

Adding your own Custom Control to a Windows forms Context Menu

March 6, 2009

Ever wanted to show your own custom control, inside the windows forms context menu? has a nice article with how-to video.

ObjectListView control

December 18, 2008

I am developing an Visual Studio package from long time to improve the time spent in reviewing code in my organization. It is in final stages of development now. In this package I have a requirement to show a tabular data for which I was using .NET list view control till 2-3 days back.

As many may know, the .NET list view control does not have built in features like column-wise sorting, alternate row colors, showing graphics etc. Though you can achieve all this in .NET list view control, it involves a extra coding from your side. Hence I was in search of perfect list view control from few days.

Finally I found a free control in The control is called as ObjectListView.

I am using this from past 2-3 days, and I am loving it. There are huge number of customizations available inside this control and I still need to explore them.  Also this control comes in different forms like, TreeListView, VirtualObjectListView etc.

Below are few screenshots of the control.


Singleton Pattern vs. Static Class

November 13, 2008

The singleton pattern ensures a class has only one instance, and provide a global point of access to it.

There is a nice article about choosing between Singleton pattern and the static class here with examples.

DebuggerStepThrough attribute

November 6, 2008

Pedram Rezaei has written how we can let .NET debugger know, not to step in to certain elements of your program with the help of DebuggerStepThroughAttribute.

Read it here

TypeCode enum in C#

June 9, 2008

Recently, one of my friend digged in to metadata of TypeCode enum type and found out that, it does not have value 17 in it.

imageEven I was surprised to see this, and wanted to know the reason behind value 17 missing from the enumeration.

I googled and found a link to blog which explains, why the value 17 has been missed from the enum.

From the author:

We’ve had this “hole” in the TypeCode enum since October of 2000, and I can’t find an older set of bits. But, I’m sure that comment in IConvertible is right – this used to be TimeSpan. For TimeSpan, it’s possible we thought it would be interesting for a while, then we realized that frankly not that many people need to convert a Decimal to a TimeSpan, then removed it.

You might ask why we didn’t “fix” the enum when we removed whichever of these values we had originally added. It turns out that whenever we have a breaking change internally, we need to recompile all the code that might possibly depend on the removed or changed public surface area. For us, that would mean rebuilding everything that might have referred to TypeCode.String, whose value would have changed from 18 to 17. While we do go through that process internally in DevDiv, it is costly & painful for us.

Accessing Master page properties

May 14, 2008

Other day I needed to access the property defined in Master page and was facing an issue. The issue was what if the master page is renamed? The namespace would change and it will break the code.

I googled for a better option and found exactly what I wanted. Below is the link where the author has neatly explained how this can be done.

Installing AnkhSVN on Vista

April 2, 2008

For those who does not know about AnkhSVN, it is a free Visual Studio .NET addin for the Subversion version control system. It allows you to perform the most common version control operations directly from inside the VS.NET IDE.

I was trying to install AnkhSVN on my office laptop, which currently running on Vista OS and has Visual Studio 2005. After setup was complete successfully I started the VS.NET and received this below error.


I initially thought it as problem with having two versions of Visual Studio (2003 and 2005) which I had. I removed VS 2003, but still received the same error.

I found this entry, which will help you to resolve this issue.,guid,a77d0675-8d15-48c2-bdce-43096ba7dbce.aspx

PS: You wont face this issue with latest version of AnkhSVN. Download from here.

Update: Subversion and TortoiseSVN Installation Cookbook


March 19, 2008

Hmm, yes! I was struggling not to sleep from past one hour and was doing all sorts of stuff (read News, gone through MSDN magazine, read RSS feeds and lastly tea) to avoid it Smile. Finally I am in a state to write this blog.

Well, I am coming up with a new tool and I am adding “Check for Update” feature to the tool. Though I am almost done with the main updating feature, but I am still struggling to add an option to show the user file download size. You might ask me what is the big fuss in that?

I do not want to keep the file sizes in some file on the server and read it from my tool. Basically I want to get the file size in the server before downloading it.

I have seen this kind of feature in many of the download managers like Free Download Manager(FDM). The FDM has a feature like have a Query size (see screenshot below), which tells you the download size before you actually start the download.


Click Query size and you will get the following screen.


I am working towards to achieve something similar. Hoping to find some solution soon!

Encountered one more error!

March 17, 2008

I recently encountered one more error and was able to resolve soon with the help of one of my colleague.

For those who reading this blog, I have no intention to keep posting errors I encountered, but after all this is a blog which is only intended to have issues encountered in my work life 🙂

However I still feel, my posts may help someone who encounters the same error. Hence with this dual things in my mind I continue to post these errors.

Ok now, I was trying to execute a mobile web application, with IIS6 and .net framework 1.1, and I got the following error.


As you can see from the screenshot, application was trying to write to Event Log. From the exception you can grasp that it is a permission issue while reading a registry key.

Following are the steps to resolve this Event Log Permission error:

1. Open registry editor.

2. Drill-down to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog.

3. Right-click on Eventlog and click permissions.

4. Add Local machine\users to the list and give full control permissions and click OK.

5. Then drill-down to next level in Eventlog\Security.

6. Right-click on Security and click permissions.

7. Add Local machine\users to the list and give full control permissions and click OK.

That’s it! This error is gone!

PS: Having said that if these steps does not resolve the issue, you can also try changing the authentication from network to System Account in IIS.

I got VS2008 Professional today!

February 24, 2008


Recently I won early bird prize at Heroes Happen Here, also as a prize money I earned MSDN Subscription from Microsoft.

I am very excited that I got my first package of MSDN subscription. The pack  contained VS2008 Professional Edition DVD and Windows Vista Ultimate Edition!

I am obviously excited!

VS2008 DVD