Thursday, August 21, 2008

Developing MS Word AddIn

I have some posts in another blog which shows how to develop and putting functionalities to your COM AddIn for Microsoft Word 2003 using c# and .Net technology.

Posts are :

Post 1 : Prerequisites for AddIn
Post 2 : Creating an AddIn
Post 3 : Registry settings for AddIn
Post 4 : Debugging your AddIn
Post 5 : Custom Actions on AddIn


Please feel free to put comment on posts and share your experience.

Cheers,

Tuesday, August 12, 2008

Sorting and Searching in Generic List


Many times I have come across sorting a list or searching an object from list.
Here I am putting those code blocks that can help us to do so....

Sorting

List persons = PopulatePersonList();
//Sort A-Z
persons.Sort(delegate(Person x, Person y)
{
return x.Name.CompareTo(y.Name);
});

For Z-A sorting, we should use,
return y.Name.CompareTo(x.Name);


Searching

List persons = PopulatePersonList();
Person p =
persons.Find(delegate(Person x)
{
if (x.Name == "abc")
return true;
else
return false;
});

The above delegate implementation can also be replaced with static function call as shown below.

List persons = PopulatePersonList();
Person p = persons.Find(IsPersonInList);

private static bool IsPersonInList(Person x)
{
if(x.Name == "abc")
return true;
else
return false;
}

Yep ! That's It...

Happy Coding__

Wednesday, August 6, 2008

Virtual PC cannot find MSXML 6 - Error on Windows Vista


.... This is a "Hello World !!" kinda blog for me.


So Please wel come me in Blogging world.

To start with..

I had installed MS Virtual PC 2007 on my laptop having Windows Vista and when I tried running this Virtual PC, it prompted me :



As the error message complains, rather suggests I tried reinstalling Virtual PC and also installing MSXML 6 and tried again.

For many, trying as suggested above works fine. Not much Pain.
If you are among those many, this post ends here.

But for me, result the same Prompt. No luck. Strange (suggestions..)!!

Well, let's proceed....

After looking here and there for about an hour and trying above MS suggestions couple of times, at the end I came to know that there are two files missing in my File Strore in system. I found these two files in my collegues' system. and copied those at C:\Users\{username}\AppData\Roaming\Microsoft\Virtual PC on my laptop.

And Magic !!! It worked.

Those files are : VPCKeyboard.dll and Options.xml.

If you come across this than I wish you are lucky enough to have helpfull collegue around you to give these files. :)

Have a nice day !!

Happy coding__