<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dot Net Thoughts</title>
	<atom:link href="http://www.dotnetthoughts.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>thoughts about .Net, WPF, Sharepoint, Javascript and more.</description>
	<lastBuildDate>Wed, 01 Sep 2010 09:53:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Create UAC Compatible applications in .NET</title>
		<link>http://www.dotnetthoughts.net/2010/09/01/create-uac-compatible-applications-in-net/</link>
		<comments>http://www.dotnetthoughts.net/2010/09/01/create-uac-compatible-applications-in-net/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 09:53:01 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[C#.Net]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1064</guid>
		<description><![CDATA[In my last project I got an opportunity to make my application compatible with Windows Vista and Windows 7. The main issue I faced was UAC; User Account Control (UAC) which introduced with the launch of Windows Vista; this provides users a better and safer computing experience. If UAC enabled, Windows will prompt every time [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">In my last project I got an opportunity to make my application compatible with Windows Vista and Windows 7. The main issue I faced was UAC; User Account Control (UAC) which introduced with the launch of Windows Vista; this provides users a better and safer computing experience. If UAC enabled, Windows will prompt every time when Applications try to access File System, like writing / creating Files in Program Files Folder, Windows Folder etc. (It’s not a best practice to write / create files in System directories like Windows, Program Files etc.). It’s also not a best practice to ask the customer to disable the UAC and run the application. The alternate is to make the application compatible with UAC, so that when the customer runs the application the system will prompts the UAC dialog, and run the application with Administrator privileges.<br />
The procedure to make the application compatible with UAC is simple.</p>
<ol>
<li>Right-click project and add a new item.</li>
<li>From the Add New Item box select Application Manifest File.</li>
<li>In the manifest file un-comment the following line:
<pre class="brush: xml;">
&lt;requestedExecutionLevel level=&quot;requireAdministrator&quot; uiAccess=&quot;false&quot; /&gt;
</pre>
</li>
</ol>
<p>Build your application. And when the build is complete you will see the security shield icon accompanying your application icon.</p>
<div id="attachment_1065" class="wp-caption aligncenter" style="width: 122px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/09/uac_app_icon.png"><img class="size-full wp-image-1065" title="Security shield icon accompanying application icon" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/09/uac_app_icon.png" alt="Security shield icon accompanying application icon" width="112" height="144" /></a><p class="wp-caption-text">Security shield icon accompanying application icon</p></div>
<p>A dialogue box appears in front of the user to run the application with full administrative privileges.</p>
<div id="attachment_1066" class="wp-caption aligncenter" style="width: 478px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/09/UAC_Dialog.png"><img class="size-full wp-image-1066" title="UAC Dialog box when double clicking on the Application" src="http://www.dotnetthoughts.net/wp-content/uploads/2010/09/UAC_Dialog.png" alt="UAC Dialog box when double clicking on the Application" width="468" height="266" /></a><p class="wp-caption-text">UAC Dialog box when double clicking on the Application</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/09/01/create-uac-compatible-applications-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable Close button of Windows Forms Application</title>
		<link>http://www.dotnetthoughts.net/2010/08/25/how-to-disable-close-button-of-windows-forms-application/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/25/how-to-disable-close-button-of-windows-forms-application/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 07:15:50 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[Win 32 API]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1050</guid>
		<description><![CDATA[We can disable the close button of a Windows Form in three ways Set controlbox property to false – It is most easy way to do this. But it also hides the Minimize and Maximize buttons. Using WIN32 API – Using Win32 API, we are getting the system menu and removes the close menu item [...]]]></description>
			<content:encoded><![CDATA[<p>We can disable the close button of a Windows Form in three ways</p>
<ol>
<li>Set controlbox  property to false – It is most easy way to do this. But it also hides the Minimize and Maximize buttons.</li>
<li>Using WIN32 API – Using Win32 API, we are getting the system menu and removes the close menu item using Remove menu item.<br />
Here is the Code.</p>
<pre class="brush: csharp;">
const int MF_BYPOSITION = 0x400;
[DllImport(&quot;User32&quot;)]
private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags);
[DllImport(&quot;User32&quot;)]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport(&quot;User32&quot;)]
private static extern int GetMenuItemCount(IntPtr hWnd);

//In the Form load event
IntPtr hMenu = GetSystemMenu(this.Handle, false);
int menuItemCount = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, menuItemCount - 1, MF_BYPOSITION);
</pre>
<p>And here is the screenshot</p>
<div id="attachment_1054" class="wp-caption aligncenter" style="width: 351px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/using_win32api.png"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/using_win32api.png" alt="Using WIN32 API" title="Using WIN32 API" width="341" height="181" class="size-full wp-image-1054" /></a><p class="wp-caption-text">Using WIN32 API</p></div>
</li>
<li>By Overriding the CreateParams property – The CreateParams property gets the required creation parameters when the control handle is created. By overriding the property we are removing the close button. You can get more information about CreateParams in <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.createparams(VS.80).aspx" target="_blank">MSDN</a><br />
Here is the code.</p>
<pre class="brush: csharp;">
private const int CS_CLOSE = 0x200;
protected override CreateParams CreateParams
{
    get
    {
        CreateParams parms = base.CreateParams;
        parms.ClassStyle |= CS_CLOSE;  //
        return parms;
    }
}
</pre>
<p>And here is the screenshot</p>
<p><div id="attachment_1053" class="wp-caption aligncenter" style="width: 351px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/using_createparams.png"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/using_createparams.png" alt="By Overriding CreateParams property" title="By Overriding CreateParams property" width="341" height="183" class="size-full wp-image-1053" /></a><p class="wp-caption-text">By Overriding CreateParams property</p></div>
<p>All of above three methods will work fine. But if you are using Windows 7 none of the above will work or OS will override all these.</p>
<div id="attachment_1058" class="wp-caption aligncenter" style="width: 241px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/win7_close.png"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/08/win7_close.png" alt="Windows 7 - Close Window" title="Windows 7 - Close Window" width="231" height="81" class="size-full wp-image-1058" /></a><p class="wp-caption-text">Windows 7 - Close Window</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/25/how-to-disable-close-button-of-windows-forms-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuple in .NET Framework 4.0</title>
		<link>http://www.dotnetthoughts.net/2010/08/19/tuples-in-dot-net-framework-4-0/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/19/tuples-in-dot-net-framework-4-0/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 11:51:10 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Tuples]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1041</guid>
		<description><![CDATA[Another new feature in the .NET 4 Framework is support for tuple,which are similar to anonymous classes that you can create on the fly. A tuple is a data structure used in many functional and dynamic languages, such as F# and Iron Python. By providing common tuple types in the BCL, we are helping to [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Another new feature in the .NET 4 Framework is support for tuple,which are similar to anonymous classes that you can create on the fly. A tuple is a data structure used in many functional and dynamic languages, such as F# and Iron Python. By providing common tuple types in the BCL, we are helping to better facilitate language interoperability. Many programmers find tuple to be convenient, particularly for returning multiple values from methods.</p>
<p>Here is a code which uses a function that returns two values.</p>
<pre class="brush: csharp;">
class Program
{
    static void Main(string[] args)
    {
        //Getting the values from the Tuple Function
        Tuple&lt;string, string&gt; details = GetDetails();
        Console.WriteLine(&quot;FirstName : {0}, LastName :{1}&quot;, details.Item1, details.Item2);
        Console.Read();
    }
    //Tuple function, which reads two values from
    //user and returns to the main
    static Tuple&lt;string, string&gt; GetDetails()
    {
        Console.Write(&quot;Enter First Name:&quot;);
        string _firstName = Console.ReadLine();
        Console.Write(&quot;Enter Last Name:&quot;);
        string _lastName = Console.ReadLine();
        return new Tuple&lt;string, string&gt;(_firstName, _lastName);
    }
}
</pre>
<p>You can find more details about Tuples in MSDN : <a href="http://msdn.microsoft.com/en-us/library/system.tuple.aspx" target="_blank">Tuple Class</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/19/tuples-in-dot-net-framework-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating PDF file using C#</title>
		<link>http://www.dotnetthoughts.net/2010/08/17/creating-pdf-file-using-c/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/17/creating-pdf-file-using-c/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 18:55:04 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[HTML to PDF]]></category>
		<category><![CDATA[iTextSharp]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1038</guid>
		<description><![CDATA[Most of the forums, it’s a common question that how can we create PDF files from C#. Few days back I got a chance to work with iTextSharp library which helps to create PDF files from .Net. You can download the iTextSharp from sourceforge.net. It also supports HTML Parsing too. Here is the code which [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the forums, it’s a common question that how can we create PDF files from C#. Few days back I got a chance to work with iTextSharp library which helps to create PDF files from .Net. You can download the iTextSharp from <a href="http://sourceforge.net/projects/itextsharp/" target="_blank">sourceforge.net</a>. It also supports HTML Parsing too.<br />
Here is the code which converts and HTML File into PDF using iTextSharp libraries.</p>
<pre class="brush: csharp;">
using System.Collections.Generic;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;

class Program
{
static void Main(string[] args)
    {
        //Creating the instance of the document object.
        Document doc = new Document();
        //Creating the PDF File
StreamWriter streamWriter = new StreamWriter(@&quot;C:\Sample.pdf&quot;);
PdfWriter.GetInstance(doc, streamWriter.BaseStream);
        doc.Open();
IEnumerable&lt;IElement&gt; elements;
        //Reading the HTML Contents
using (StreamReader streamReader = new StreamReader(@&quot;C:\SamplePage.htm&quot;))
        {
            //Parsing HTML Contents.
elements = HTMLWorker.ParseToList(streamReader, new StyleSheet());
        }
foreach (IElement item in elements)
        {
            doc.Add(item);
        }
        //Custom Text which will be appended using Paragraph class.
        string paragraph = &quot;This is custom text which will be appended&quot;;
        doc.Add(new Paragraph(paragraph));

        //Closing the document.
        doc.Close();
    }
}
</pre>
<p>Thanks to Rahul for providing initial inputs on iTextSharp library.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/17/creating-pdf-file-using-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optional Parameters and Named Parameters in C# 4.0</title>
		<link>http://www.dotnetthoughts.net/2010/08/16/optional-parameters-and-named-parameters-in-c-4-0/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/16/optional-parameters-and-named-parameters-in-c-4-0/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 08:47:40 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Named Parameters]]></category>
		<category><![CDATA[Optional Parameters]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1035</guid>
		<description><![CDATA[Last day I got an assignment to explore new features of .Net Framework 4.0. So I thought about writing a few posts with the new features. The first feature I explored was Optional Parameters and Named Parameters, as I am coming from VB background, I missed this feature in C# and yes we can resolve [...]]]></description>
			<content:encoded><![CDATA[<p>Last day I got an assignment to explore new features of .Net Framework 4.0. So I thought about writing a few posts with the new features. The first feature I explored was Optional Parameters and Named Parameters, as I am coming from VB background, I missed this feature in C# and yes we can resolve this using Overloading still we missed that feature. In .Net 4.0 Microsoft introduced Optional Parameters and Named Parameters in C#.</p>
<p>Both of these features are almost similar like in VB 6 or in VB.Net, unlike we don’t need an optional keyword.</p>
<pre class="brush: csharp;">
class Program
{
    static void Main(string[] args)
    {
        //Optional Parameters
        ShowMessage(&quot;Hello World&quot;);
        //Named parameters
        ShowMessage(&quot;HelloWorld&quot;, backColor: ConsoleColor.Blue);
        //Normal Function call
        ShowMessage(&quot;Hello World&quot;, ConsoleColor.Red, ConsoleColor.Blue);

        Console.Read();
    }

    //In .Net 4.0
    static void ShowMessage(string message,
        ConsoleColor foreColor = ConsoleColor.Black,
        ConsoleColor backColor = ConsoleColor.White)
    {
        Console.ForegroundColor = foreColor;
        Console.BackgroundColor = backColor;
        Console.WriteLine(message);
        //Resetting Console colors to default.
        Console.ResetColor();
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/16/optional-parameters-and-named-parameters-in-c-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DevCon 2010 &#8211; Part 2 on 4th Sept at Trivandrum</title>
		<link>http://www.dotnetthoughts.net/2010/08/15/devcon-2010-part-2-on-4th-sept-at-trivandrum/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/15/devcon-2010-part-2-on-4th-sept-at-trivandrum/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 06:52:21 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[User Group Activities]]></category>
		<category><![CDATA[DevCon]]></category>
		<category><![CDATA[DevCon 2010]]></category>
		<category><![CDATA[K-MUG]]></category>
		<category><![CDATA[Kerala Microsoft Users Group]]></category>
		<category><![CDATA[Microsoft Users Group]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1030</guid>
		<description><![CDATA[The Kerala Microsoft Users Group (K-MUG) will be organising a Developers Conference, DevCon 2010 on September 4th, 2010 at ParkCenter,Technopark in Trivandrum. K-MUG is one of the best developer community in India, which got Best User Group award in India as part of Microsoft Community Impact award 2010. DevCon 2010 will help you to engage [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_920" class="wp-caption aligncenter" style="width: 382px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/06/devconlogo.png"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/06/devconlogo.png" alt="DevCon 2010 Logo" title="DevCon 2010" width="372" height="109" class="size-full wp-image-920" /></a><p class="wp-caption-text">DevCon 2010</p></div>
<p>The Kerala Microsoft Users Group (K-MUG) will be organising a Developers Conference, DevCon 2010 on September 4th, 2010 at ParkCenter,Technopark in Trivandrum. K-MUG is one of the best developer community in India, which got Best User Group award in India as part of Microsoft Community Impact award 2010. DevCon 2010 will help you to engage and collaborate with Microsoft MVPs and thousands of your IT peers.</p>
<p>DevCon 2010 Part-2 will be conducting at Technopark on with the following agenda.<br />
<strong>Morning Sessions</strong><br />
08:30AM – 09:30AM – Registration Confirmation<br />
09:30AM – 10:30AM – Functional programing with F#<br />
10:30AM – 11:30AM – Power Shell – Your Wish is my Command<br />
11:30AM – 11:45AM – Tea Break<br />
11:45AM – 12:30PM – Visual Studio 2010 tips<br />
12:30PM – 01:15PM – ASP.NET MVC2<br />
01:15PM – 02:00PM – Lunch<br />
<strong>Afternoon Sessions</strong><br />
02:00PM – 02:45PM – Great Developer Contest – Final<br />
02:45PM – 03:45PM – Office Addins with Visual Studio 2010<br />
03:45PM – 04:30PM – Entity Framework 4<br />
04:30PM – 05:00PM – Closing Ceremony</p>
<p>You can find more details <a target="_blank" href="http://k-mug.org/events/devcon2010/">here</a>, and you can register <a target="_blank" href="http://www.eventbrite.com/event/796429141?ref=ebtn">here</a>.</p>
<p>See you at DevCon 2010 <img src='http://www.dotnetthoughts.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/15/devcon-2010-part-2-on-4th-sept-at-trivandrum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
