<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7176498828566901874</id><updated>2012-02-16T18:34:18.743-08:00</updated><category term='Disable the Win Form’s Close Button using C#'/><title type='text'>S.Vinothkumar</title><subtitle type='html'>Hello and Welcome!   Most of the articles at this site were created in response to questions, comments, or arguments put forth by people who challenge the pre tribulation rapture.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default?start-index=101&amp;max-results=100'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>147</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-646424726510985134</id><published>2010-07-23T00:47:00.000-07:00</published><updated>2010-07-23T00:51:14.510-07:00</updated><title type='text'>Difference between DataGrid and GridView</title><content type='html'>&lt;span style="color:#ccffff;"&gt;Hi All !&lt;br /&gt;&lt;br /&gt;I am back !!!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;strong&gt;Difference between DataGrid and GridView:&lt;br /&gt;========================================== &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffff;"&gt;In .Net 2.0, we are using GridView. Since DataGrid and GridView are same we have some extra facilities and features in GridView than DataGrid.&lt;br /&gt;&lt;br /&gt;By using GridView we can render it on Mobile Devices also, but DataGrid only use for web pages. Another key difference between DataGrid and GridView controls lies in the adaptive user interface.&lt;br /&gt;&lt;br /&gt;In DataGrid paging, sorting, inserting, updating and deleting are implementing by coding. But in GridView automatically generates those things without user writing the code.&lt;br /&gt;Sorting: In DataGrid code requires handling the SortCommand event and rebind grid required. In case of GridView no additional code required.&lt;br /&gt;Paging: In DataGrid requires code to handle the PageIndexChanged event and rebind grid required. In case of GridView no additional code required. It also supports customized appearance.&lt;br /&gt;Data binding: Like GridView DataGrid cannot bind with new datasource control in ASP.NET 2.0.&lt;br /&gt;Updating data: DataGrid requires extensive code to update operation on data. GridView requires little code. Code like exceptions handling for database part.&lt;br /&gt;Events: GridView supports events fired before and after database updates. In DataGrid fewer events supported as compared to GridView.&lt;br /&gt;&lt;br /&gt;In DataGrid no image template column, whereas GridView have image template column&lt;br /&gt;The GridView control is the successor to the DataGrid control. Like the DataGrid control, the GridView control was designed to display data in an HTML table. When bound to a data source, the DataGrid and GridView controls each display a row from a DataSource as a row in an output table.&lt;br /&gt;&lt;br /&gt;Both the DataGrid and GridView controls are derived from the WebControl class. Although it has a similar object model to that of the DataGrid control, the GridView control also has a number of new features and advantages over the DataGrid control, which include:&lt;br /&gt;&lt;br /&gt;Richer design-time capabilities.&lt;br /&gt;&lt;br /&gt;Improved data source binding capabilities.&lt;br /&gt;&lt;br /&gt;Automatic handling of sorting, paging, updates, and deletes.&lt;br /&gt;&lt;br /&gt;Additional column types and design-time column operations.&lt;br /&gt;&lt;br /&gt;A Customized pager user interface (UI) with the PagerTemplate property.&lt;br /&gt;&lt;br /&gt;Differences between the GridView control and the DataGrid control include:&lt;br /&gt;&lt;br /&gt;Different custom-paging support.&lt;br /&gt;&lt;br /&gt;Different event models.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#330000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-646424726510985134?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/646424726510985134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=646424726510985134' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/646424726510985134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/646424726510985134'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2010/07/difference-between-datagrid-and.html' title='Difference between DataGrid and GridView'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7527027242751030665</id><published>2009-09-03T03:40:00.000-07:00</published><updated>2009-09-03T03:44:50.723-07:00</updated><title type='text'>How to clear temporary internet foder by using C# in winforms?</title><content type='html'>Here is the sample code for clearing temporary internet foder by using C# in winforms.&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;private void btnClear_Click(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            ClearAll(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            MessageBox.Show("Your temporary files has been cleaned.! ");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;       public void ClearAll(DirectoryInfo dirInfo)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            foreach (FileInfo fileInfo in dirInfo.GetFiles())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                try&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    fileInfo.Delete();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                catch { }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            foreach (DirectoryInfo subDirectory in dirInfo.GetDirectories())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                ClearAll(subDirectory);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinotkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7527027242751030665?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7527027242751030665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7527027242751030665' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7527027242751030665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7527027242751030665'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/09/how-to-clear-temporary-internet-foder.html' title='How to clear temporary internet foder by using C# in winforms?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6909335966689922352</id><published>2009-08-19T03:16:00.000-07:00</published><updated>2009-08-19T03:19:30.097-07:00</updated><title type='text'>How to insert bulk values in to a table by using C#?</title><content type='html'>The below method is used to bulk insert in to a table by using c# from a datatable.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Data;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Data.SqlClient;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public int BulkInsert(DataTable dt, string TableName, string ConnectionString)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; int returnValue = -1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; SqlConnection oConn = new SqlConnection(ConnectionString);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; oConn.Open();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM " + TableName,oConn);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; da.SelectCommand.Connection = oConn;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; DataSet ds = new DataSet();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; SqlCommandBuilder oCmd = new SqlCommandBuilder(da);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; try&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  da.Fill(ds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  returnValue = da.Update(dt);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; catch (Exception ex)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  throw ex;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; finally&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  oConn.Close();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  oCmd.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; return returnValue;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6909335966689922352?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6909335966689922352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6909335966689922352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6909335966689922352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6909335966689922352'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/08/how-to-insert-bulk-values-in-to-table.html' title='How to insert bulk values in to a table by using C#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4071869395136415522</id><published>2009-08-19T03:03:00.000-07:00</published><updated>2009-08-19T03:06:32.203-07:00</updated><title type='text'>Copy All Directories with Files using C#</title><content type='html'>Here is the sample code for copying a directory with sub directories and all the files using C#.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public static void CopyAllDirectories(DirectoryInfo source, DirectoryInfo target)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        if (Directory.Exists(target.FullName) == false)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Directory.CreateDirectory(target.FullName);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        foreach (FileInfo fileInfo in source.GetFiles())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {            fileInfo.CopyTo(Path.Combine(target.ToString(),fileInfo.Name), true);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        foreach (DirectoryInfo sourceSubDir in source.GetDirectories())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            DirectoryInfo targetSubDir =&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                target.CreateSubdirectory(sourceSubDir.Name);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            CopyAllDirectories (sourceSubDir, targetSubDir);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4071869395136415522?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4071869395136415522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4071869395136415522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4071869395136415522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4071869395136415522'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/08/copy-all-directories-with-files-using-c.html' title='Copy All Directories with Files using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3052260181649277445</id><published>2009-08-03T06:05:00.000-07:00</published><updated>2009-08-03T06:14:29.692-07:00</updated><title type='text'>Scrollbar in down side of textbox.</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Scrollbar in down side of textbox.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hi all, I have come to give a very simple solution for the below question. The question is&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;How to set scrollbar in end of the text in textbox when dynamically updating the text value?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Actually I have been developing a big application. On that application I needed to update the status of every action in my application. For the purpose of updating the status, I have used the textbox to show the status with &lt;span style="font-weight: bold;"&gt;multiline &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;vertical scrollbar&lt;/span&gt; properties. But I could see  the vertical bar not going down when updating the status as shown in the below figure which is marked in red.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTawyT4n2e4/Snbg3nRUm9I/AAAAAAAABBo/Ak1C3_HX24E/s1600-h/scrolldown1.JPG"&gt;&lt;img style="cursor: pointer; width: 301px; height: 301px;" src="http://3.bp.blogspot.com/_MTawyT4n2e4/Snbg3nRUm9I/AAAAAAAABBo/Ak1C3_HX24E/s320/scrolldown1.JPG" alt="" id="BLOGGER_PHOTO_ID_5365723252097588178" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After googling few minutes I found we have some properties and methods in textboxes of visual studio are &lt;span style="font-weight: bold;"&gt;SelectionStart &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;ScrollToCaret &lt;/span&gt;method.&lt;br /&gt;&lt;br /&gt;By using the above property and method I have found the solution for my question. See the below figure...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTawyT4n2e4/Snbg8ngZ0HI/AAAAAAAABBw/dmwh9CWP8zI/s1600-h/scrolldown2.JPG"&gt;&lt;img style="cursor: pointer; width: 299px; height: 301px;" src="http://4.bp.blogspot.com/_MTawyT4n2e4/Snbg8ngZ0HI/AAAAAAAABBw/dmwh9CWP8zI/s320/scrolldown2.JPG" alt="" id="BLOGGER_PHOTO_ID_5365723338060189810" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Code Snippet:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void btnUpdate_Click(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; if (!string.IsNullOrEmpty(txtStatus.Text))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;     txtStatus.Text = txtStatus.Text + Environment.NewLine;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; txtStatus.Text = txtStatus.Text + "Status Updated...";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; txtStatus.SelectionStart = txtStatus.Text.Length;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; txtStatus.ScrollToCaret();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; txtStatus.Refresh();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3052260181649277445?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3052260181649277445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3052260181649277445' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3052260181649277445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3052260181649277445'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/08/scrollbar-in-down-side-of-textbox.html' title='Scrollbar in down side of textbox.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTawyT4n2e4/Snbg3nRUm9I/AAAAAAAABBo/Ak1C3_HX24E/s72-c/scrolldown1.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4346043646354368261</id><published>2009-07-29T23:42:00.000-07:00</published><updated>2009-07-29T23:45:41.276-07:00</updated><title type='text'>Barcode Generation using C#</title><content type='html'>In this article, I am trying to give you a sample code for generating barcode image by using C#.&lt;br /&gt;&lt;br /&gt;We can see in market for all products they are using barcode only. So the barcode is common one. When we try to programming with old language for barcode is very difficult. We needed to go third party component. But in .Net framework it is very easy to generate barcode image.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Barcode font&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is lot of free barcode fonts available in internet. We can search and download it for generating the barcode image. Here is the font which is I am using “Barcodefont.ttf”. We need to download this font and install in your fonts folder which is located in control panel.&lt;br /&gt;&lt;br /&gt;For generating barcode image, we need to add the namespaces “System.Drawing, System.Drawing.Imaging” and the file management namespaces.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sample Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Drawing.Text;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Drawing;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.IO;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Drawing.Imaging;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public string dirPath = "";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;dirPath = Environment.CurrentDirectory;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void GenerateBarCode()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; try&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  string path = dirPath + "\\" + DateTime.Now.ToFileTimeUtc().ToString() + ".jpg";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  PrivateFontCollection fontCollection = new PrivateFontCollection();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  fontCollection.AddFontFile(dirPath + "\\BarcodeFont.ttf");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  FontFamily fontFamily = new FontFamily("barcode font", fontCollection);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  Font font = new Font(fontFamily, 40);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  Bitmap bmp = new Bitmap(pbBarcodeImage.Width, pbBarcodeImage.Height);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  Graphics graphics = Graphics.FromImage(bmp);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  graphics.Clear(Color.White);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  SizeF sizeF = graphics.MeasureString(txtEnter.Text.Trim(), font);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  Brush brush = new SolidBrush(Color.Black);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  graphics.DrawString(txtEnter.Text.Trim(), font, brush, 10, 10);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  bmp.Save(path, ImageFormat.Jpeg);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  bmp.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  pbBarcodeImage.Image = new Bitmap(path);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; catch&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; { }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hence we are generating the barcode by using the above code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4346043646354368261?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4346043646354368261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4346043646354368261' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4346043646354368261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4346043646354368261'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/07/barcode-generation-using-c.html' title='Barcode Generation using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4451881948787091686</id><published>2009-07-01T03:07:00.000-07:00</published><updated>2009-07-01T03:13:27.177-07:00</updated><title type='text'>Inserting Bulk Data in SQL Server from Text file</title><content type='html'>There is a simple query to do this bulk insert in to sql server from a text file. The thing is that we have to keep a fully formatted text file with appropriate data’s which are to be inserted.&lt;br /&gt;&lt;br /&gt;Here, we have a table to be inserted is,&lt;br /&gt;&lt;br /&gt;The query for creating table,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;CREATE TABLE Employee&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; FName varchar (100) NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; LName varchar (100) NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; Email varchar (100) NOT NULL&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we have a text file with the bulk data’s like as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;vinoth,kumar,itvinoth83@gmail.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp1FName,emp1LName,emp1@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp2FName,emp2LName,emp2@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp3FName,emp3LName,emp3@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp4FName,emp4LName,emp4@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp5FName,emp5LName,emp5@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp6FName,emp6LName,emp6@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp7FName,emp7LName,emp7@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp8FName,emp8LName,emp8@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp9FName,emp9LName,emp9@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp10FName,emp10LName,emp10@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp11FName,emp11LName,emp11@company.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;emp12FName,emp12LName,emp12@company.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now the query for inserting bulk data is,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;BULK INSERT Employee FROM 'c:\bulktext.txt' WITH (FIELDTERMINATOR = ',')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now you can see the data's inserted in table by the select query as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;select * from Employee&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following image is being explained the above matters.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTawyT4n2e4/Sks1uNsdovI/AAAAAAAABAw/XlOhddRhEBU/s1600-h/bulkinsert.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 254px;" src="http://3.bp.blogspot.com/_MTawyT4n2e4/Sks1uNsdovI/AAAAAAAABAw/XlOhddRhEBU/s320/bulkinsert.JPG" alt="" id="BLOGGER_PHOTO_ID_5353431650126373618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4451881948787091686?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4451881948787091686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4451881948787091686' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4451881948787091686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4451881948787091686'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/07/inserting-bulk-data-in-sql-server-from.html' title='Inserting Bulk Data in SQL Server from Text file'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTawyT4n2e4/Sks1uNsdovI/AAAAAAAABAw/XlOhddRhEBU/s72-c/bulkinsert.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8060241665029134155</id><published>2009-06-27T00:26:00.000-07:00</published><updated>2009-06-27T00:33:08.146-07:00</updated><title type='text'>Multiple Colored texts in RichTextBox using C#</title><content type='html'>&lt;div style="text-align: justify;"&gt;This article is created for making multiple colored texts in a textbox. By using the SelectionText property in richtextbox we have created a sample application for multiple colored texts in Microsoft’s richtextbox control. Let us see how to make it in below code.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;           &lt;span style="color: rgb(255, 255, 204);"&gt; Font font = new Font("Tahoma", 8, FontStyle.Regular);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            richTextBox1.SelectionFont = font;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            richTextBox1.SelectionColor = Color.Red;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            richTextBox1.SelectedText = Environment.NewLine + textBox1.Text;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;By using the above code, we can make a multiple colored texts in our richtextbox. This is basically used for doing some chat application. We will have to show the other end of person’s text in different color in chat application. So that we can use this method. And we can create a simple method and calling in every time of showing the text in richtextbox with the parameters of like “textbox1.text, color,..etc”.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;For more visit my article in codeproject &lt;a href="http://www.codeproject.com/KB/cs/MultiColored_textbox.aspx"&gt;here &lt;/a&gt;with more explanation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8060241665029134155?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8060241665029134155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8060241665029134155' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8060241665029134155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8060241665029134155'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/multiple-colored-texts-in-richtextbox.html' title='Multiple Colored texts in RichTextBox using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4641344226276583890</id><published>2009-06-19T22:39:00.000-07:00</published><updated>2009-06-19T23:05:29.977-07:00</updated><title type='text'>How to sum previous rows value SqlServer?</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;I needed to write a query for sum the values with the previous row value in &lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;current row of a column. So that I have written a singl&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;e query after a long googled. Here I am trying to give yo&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;u what I have done.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;I have a table with three fields Id, Name and &lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Mark. I have values of all fields like as follows.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Id       Name   Mark&lt;br /&gt;---    -----    -----&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;1    aaaa    10&lt;br /&gt;2    bbbb    20&lt;br /&gt;3    cccc    30&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Now I wants to get the results set of that table like as&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;Id       Name   Mark&lt;br /&gt;---    -----    -----&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;1    aaaa    10&lt;br /&gt;2    bbbb    30&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;3    cccc    60&lt;br /&gt;&lt;br /&gt;So I need a single select query to do this performance. For that I have written a query using cross join.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold;" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Code Snippets for Table and Query&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold; color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;span style="font-weight: normal;"&gt;CREATE TABLE [dbo].[Marks](&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;    [Id] [bigint] NOT NULL,&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;    [Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;    [Mark] [bigint] NOT NULL&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;) ON [PRIMARY]&lt;/span&gt;   &lt;span style="font-weight: normal;"&gt; &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold; color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold; color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;span style="font-weight: normal;"&gt;select * from Marks&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold;" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTawyT4n2e4/Sjx6o6PRRSI/AAAAAAAABAI/CyBK8ccJ0dQ/s1600-h/mark1.JPG"&gt;&lt;img style="cursor: pointer; width: 130px; height: 78px;" src="http://3.bp.blogspot.com/_MTawyT4n2e4/Sjx6o6PRRSI/AAAAAAAABAI/CyBK8ccJ0dQ/s320/mark1.JPG" alt="" id="BLOGGER_PHOTO_ID_5349285300655965474" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;select a.Id, a.Name, sum(b.Mark) as Mark&lt;br /&gt;from Marks a cross join Marks b&lt;br /&gt;where b.Id &lt;= a.Id group by a.Id, a.Name&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_MTawyT4n2e4/Sjx7YektCDI/AAAAAAAABAQ/lATtmFCbvdQ/s1600-h/mark2.JPG"&gt;&lt;img style="cursor: pointer; width: 130px; height: 78px;" src="http://1.bp.blogspot.com/_MTawyT4n2e4/Sjx7YektCDI/AAAAAAAABAQ/lATtmFCbvdQ/s320/mark2.JPG" alt="" id="BLOGGER_PHOTO_ID_5349286117863393330" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Hence we have done the fetching the result set for sum of the previous rows in sql server.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;For more ...&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;visit &lt;a href="http://www.codeproject.com/KB/database/sum_previous_rows.aspx"&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4641344226276583890?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4641344226276583890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4641344226276583890' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4641344226276583890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4641344226276583890'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/how-to-sum-previous-rows-value.html' title='How to sum previous rows value SqlServer?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTawyT4n2e4/Sjx6o6PRRSI/AAAAAAAABAI/CyBK8ccJ0dQ/s72-c/mark1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-9192320997633266905</id><published>2009-06-16T03:53:00.000-07:00</published><updated>2009-06-16T04:02:49.320-07:00</updated><title type='text'>Multiple rows in a single row with separator in SqlServer</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;br /&gt;Here is a simple way to make a single row value from multiple rows with a separator in SqlServer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I have a table like the following…&lt;br /&gt;&lt;br /&gt;Table Name: People&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;select * from people&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_MTawyT4n2e4/Sjd6Ht2bl1I/AAAAAAAAA_4/LpSYe_7IjAs/s1600-h/tblPeoplt.JPG"&gt;&lt;img style="cursor: pointer; width: 243px; height: 292px;" src="http://3.bp.blogspot.com/_MTawyT4n2e4/Sjd6Ht2bl1I/AAAAAAAAA_4/LpSYe_7IjAs/s320/tblPeoplt.JPG" alt="" id="BLOGGER_PHOTO_ID_5347877355511322450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Now I need the ‘Name’ column values where matching the value of ‘aaaa’ in to a single row. For this I have tried to make a query.&lt;br /&gt;&lt;br /&gt;Just use the following query to get the solution.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;declare @res varchar(1000)    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;select @res = coalesce(@res + ',', '') +Name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;      from  people&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;      WHERE Name = 'aaaa'  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;select @res&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;See the result…&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_MTawyT4n2e4/Sjd6Qn9dkaI/AAAAAAAABAA/50kcT9feVTM/s1600-h/ans.JPG"&gt;&lt;img style="cursor: pointer; width: 187px; height: 65px;" src="http://1.bp.blogspot.com/_MTawyT4n2e4/Sjd6Qn9dkaI/AAAAAAAABAA/50kcT9feVTM/s320/ans.JPG" alt="" id="BLOGGER_PHOTO_ID_5347877508549022114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-9192320997633266905?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/9192320997633266905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=9192320997633266905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/9192320997633266905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/9192320997633266905'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/multiple-rows-in-single-rows-with.html' title='Multiple rows in a single row with separator in SqlServer'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MTawyT4n2e4/Sjd6Ht2bl1I/AAAAAAAAA_4/LpSYe_7IjAs/s72-c/tblPeoplt.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8455017729553575152</id><published>2009-06-11T05:29:00.001-07:00</published><updated>2009-06-11T05:33:46.703-07:00</updated><title type='text'>Simple recursive function for string folding in C#</title><content type='html'>Here is the sample function of string folding in c#. I just tried  bind the body content of a mail in to a label box. For that I need to folding the string content. I have created a method to do this string folding as follows,&lt;br /&gt;&lt;br /&gt;      &lt;span style="color: rgb(255, 255, 204);"&gt;  if (lblBody.Text.Length &gt; 150)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                lblBody.Text = lblbodystring(lblBody.Text,150);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;//Simple recursive function for string folding. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private string lblbodystring(string bodyString, int Length)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            string retVal = "";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            if (bodyString.Length &gt; Length)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                retVal = bodyString.Substring(0, Length);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                retVal = retVal + Environment.NewLine;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                retVal = retVal + lblbodystring(bodyString.Substring(Length));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                retVal = retVal + Environment.NewLine;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                retVal = retVal + bodyString;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            return retVal;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The thing is that we can use textbox with multiline attribute for this kind of process :). But I have used in label. So...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8455017729553575152?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8455017729553575152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8455017729553575152' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8455017729553575152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8455017729553575152'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/simple-recursive-function-for-string.html' title='Simple recursive function for string folding in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4956026747966622670</id><published>2009-06-11T04:25:00.000-07:00</published><updated>2009-06-11T05:28:05.134-07:00</updated><title type='text'>Query for importing data’s from XL to SqlServer DB</title><content type='html'>Here is a simple query for importing data's from Microsoft Excel sheet to Sql Server database.&lt;br /&gt;&lt;br /&gt;Just copy the following code and run in your sql server query window. Before that make XL sheet with the appropriate fields and values and place it in c drive or wherever you wants.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;INSERT INTO [dbo].[TableName] ([FieldName1]&lt;/span&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;           ,[FieldName2]&lt;/span&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;           ,[FieldName3]&lt;/span&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;           ,[FieldName4]&lt;/span&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',&lt;/span&gt; &lt;span style="color: rgb(255, 255, 204);"&gt;'Data Source=C:\db.xls;Extended Properties=Excel 8.0')...[SheetName$]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;that's it...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4956026747966622670?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4956026747966622670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4956026747966622670' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4956026747966622670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4956026747966622670'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/query-for-importing-datas-from-xl-to.html' title='Query for importing data’s from XL to SqlServer DB'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1474390493712097354</id><published>2009-06-11T03:46:00.000-07:00</published><updated>2009-06-11T03:49:28.260-07:00</updated><title type='text'>Silverlight - Introduction</title><content type='html'>Microsoft Silverlight is a programmable web browser plug-in that enables features such as animation, vector graphics and audio-video playback that characterizes rich Internet applications.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Silverlight provides a retained mode graphics system similar to Windows Presentation Foundation, and integrates multimedia, graphics, animations and interactivity into a single runtime environment. In Silverlight applications, user interfaces are declared in XAML and programmed using a subset of the .NET Framework. XAML can be used for marking up the vector graphics and animations. Textual content created with Silverlight is searchable and indexable by search engines as it is not compiled, but represented as text (XAML).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255); font-weight: bold;"&gt;Releases&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Silverlight 1.0&lt;br /&gt;2. Silverlight 2&lt;br /&gt;3. Silverlight 3&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Tools for Silverlight application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To developing Silverlight application, Microsoft has been released some set of tools. They are,&lt;br /&gt;&lt;br /&gt;•    Visual Studio 2008 with Service Pack 1&lt;br /&gt;•    Silverlight 2 Beta 2 SDK&lt;br /&gt;•    Expression Blend 2 July 2008 Preview&lt;br /&gt;&lt;br /&gt;All of us known about Visual Studio. Expression Blend is Microsoft's user interface design tool for creating graphical interfaces for web and desktop applications. Blend is writing using the .NET Framework 3.0 and Windows Presentation Foundation (WPF). Microsoft Expression Blend does the same of Adobe Photoshop to edit your images as well as add effects to existing images.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;How to create Silverlight applications? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is a question in our mind raising that “How to create Silverlight applications?” Here is the answer for your question,&lt;br /&gt;&lt;br /&gt;1.    Use Visual Studio 2008 SP1 to create a new Silverlight project based on the Silverlight 2 Beta 2 Template. Visual Studio will do the necessary steps to add a single HTML page or a single website to host your Silverlight application. This is because Silverlight is a plug-in that renders in the browser.&lt;br /&gt;&lt;br /&gt;2.    Add your necessary XAML files needed for the user interface. This is similar to the forms that you would add to a Windows Form application.&lt;br /&gt;&lt;br /&gt;3.    Edit the XAML page using Expression Blend 2 July 2008 preview. Note that Because each page in Silverlight 2 Beta 2 is treated as a user control, only Expression Blend 2 July 2008 preview will be capable of opening these particular XAML files. Any older version of Expression Blend will throw an error message saying that it is unable to open that file type.&lt;br /&gt;&lt;br /&gt;4.    Switch to Visual Studio 2008 SP1 to write code behind files for the controls and pages that you created in Step 2.&lt;br /&gt;&lt;br /&gt;5.    Build and compile the application.&lt;br /&gt;&lt;br /&gt;6.    Host the same in IIS or any web server of your choice. For this demonstration, you will rely on Windows Vista for development and IIS for hosting the application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1474390493712097354?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1474390493712097354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1474390493712097354' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1474390493712097354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1474390493712097354'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/silverlight-introduction.html' title='Silverlight - Introduction'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-566926888356139625</id><published>2009-06-11T03:35:00.000-07:00</published><updated>2009-06-11T03:45:32.974-07:00</updated><title type='text'>Simple Collapse Panel - Windows application in C#</title><content type='html'>Hi all, There is no option to collapsing functionality in panel control.&lt;span style="line-height: 115%;font-family:Calibri;font-size:11;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have created a panel control with up/down arrow images. We can collapse this control by clicking those arrows. There are some property values allowing us the interval of collapsing time. The &lt;span style="font-weight: bold;"&gt;ScrollInterval&lt;/span&gt; value is used to set the interval time for collapsing animation. And the &lt;span style="font-weight: bold;"&gt;HeaderHeight&lt;/span&gt; property value is set to be the height of header part in this control. I just used some calculation to set the height value for this control in a certain loop. This much of calculation makes some animation to collapsing the control.&lt;br /&gt;&lt;br /&gt;You can see the magic of this control by downloading the demo project which is available to download &lt;a href="http://www.codeproject.com/KB/cs/CollapsePanel.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The simple calculation of control’s height is possible to collapse the control. Just see the following code,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if (this.Height &gt; this.lblTop.Height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                while (this.Height &gt; this.lblTop.Height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    Application.DoEvents();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    this.Height -= ScrollIntervalValue;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                this.lblTop.ImageIndex = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                this.Height = this.lblTop.Height;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            else if (this.Height == this.lblTop.Height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                int x = this.FixedHeight;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                while (this.Height &lt;= (x))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    Application.DoEvents();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    this.Height += ScrollIntervalValue;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                this.lblTop.ImageIndex = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                this.Height = x;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Just refer the control in your application, and add the control in your form. Then set the property values of this control ScrollInterval and HeaderHeight as you want. If you don’t set those property values it might be taken by default values. Now build your project and run. By clicking the arrow images in collapse panel, you can see the magic.&lt;br /&gt;&lt;br /&gt;For More…see my article in code project.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/KB/cs/CollapsePanel.aspx"&gt;http://www.codeproject.com/KB/cs/CollapsePanel.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Calibri; 	mso-font-alt:Arial; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:Calibri; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-566926888356139625?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/566926888356139625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=566926888356139625' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/566926888356139625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/566926888356139625'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/simple-collapse-panel-windows.html' title='Simple Collapse Panel - Windows application in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7699355617335426260</id><published>2009-06-03T00:41:00.000-07:00</published><updated>2009-06-03T00:45:18.473-07:00</updated><title type='text'>How do we change the header BackColor and selected color in ListView using c#?</title><content type='html'>&lt;span style="font-weight: bold;"&gt;How do we change the header BackColor and selected color in ListView using c#?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yes, we can make it possible to change the header backcolor and style for ListView control. And also we can change the some styles in ListView control in the code behind. Here is the way to explain how it is possible.&lt;br /&gt;&lt;br /&gt;There is property named “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;OwnerDraw&lt;/span&gt;” is used to do the style changing process by our code behind. Just we need to set that property as “true”.&lt;br /&gt;&lt;br /&gt;I have a ListView control with the name of “&lt;span style="font-weight: bold;"&gt;lstView&lt;/span&gt;” in my sample form, and the code has been written as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.BackColor = System.Drawing.SystemColors.ControlText;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.BorderStyle = System.Windows.Forms.BorderStyle.None;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.columnHeader1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.columnHeader2,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.columnHeader3});&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.ForeColor = System.Drawing.SystemColors.ControlLightLight;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.FullRowSelect = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.Location = new System.Drawing.Point(2, 1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.MultiSelect = false;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.Name = "lstView";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.OwnerDraw = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;this.lstView.View = System.Windows.Forms.View.Details;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void lstView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; System.Drawing.Drawing2D.LinearGradientBrush GradientBrush = new  System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Blue, Color.LightBlue, 270);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; e.Graphics.FillRectangle(GradientBrush, e.Bounds);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.White), 2), e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 2, e.Bounds.Height - 2);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;e.Graphics.DrawString(e.Header.Text, new Font("Arial", 12), new  SolidBrush(Color.Yellow), e.Bounds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void lstView_DrawItem(object sender, DrawListViewItemEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; if (e.Item.Selected)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  e.Graphics.FillRectangle(new SolidBrush(Color.DarkBlue), e.Bounds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; e.Graphics.DrawString(e.Item.Text, new Font("Arial", 10), new SolidBrush(Color.White), e.Bounds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void lstView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; e.Graphics.DrawString(e.Item.Text, new Font("Arial", 10), new SolidBrush(Color.White), e.Bounds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7699355617335426260?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7699355617335426260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7699355617335426260' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7699355617335426260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7699355617335426260'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/how-do-we-change-header-backcolor-and.html' title='How do we change the header BackColor and selected color in ListView using c#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3988743652324865583</id><published>2009-06-01T23:49:00.001-07:00</published><updated>2009-06-03T00:16:45.885-07:00</updated><title type='text'>How to change the header backcolor in datagridview C#</title><content type='html'>Here I am trying to get the new design for my DataGridView header back color. So that, I have been tried a lot in Google and got the solution which is explained below.&lt;br /&gt;&lt;br /&gt;Set the following properties for your DataGridView control by using the properties window.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;EnableHeadersVisualStyles = False&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;RowHeadersBorderStyle = Raised&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then copy the following code in your &lt;span style="font-weight: bold;"&gt;Form_Load&lt;/span&gt; event.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;DataGridViewCellStyle style = this.dataGridView1.ColumnHeadersDefaultCellStyle;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;style.BackColor = Color.WhiteSmoke;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;style.ForeColor = Color.Gray;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;style.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now run your application, the header style would be changed and showing a new style that we wants.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3988743652324865583?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3988743652324865583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3988743652324865583' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3988743652324865583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3988743652324865583'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/06/how-to-change-header-backcolor-in_01.html' title='How to change the header backcolor in datagridview C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2091750162905174481</id><published>2009-05-06T03:46:00.000-07:00</published><updated>2009-05-06T03:48:36.813-07:00</updated><title type='text'>What is OfType operator in LINQ?</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;OfType operator in LINQ&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;OfType operator is used to return objects of a certain type. For example if we have an array of objects which contains strings, decimal, float and numbers or any other. We can use OfType operator to extract only strings or any particular type of values.&lt;br /&gt;&lt;br /&gt;Here is an example to fetch the string values from an array of objects. See below,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void Form1_Load(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; object[] values = {"test1",45,'c',"test2",34.67,12/12/2009,"test3",4.0,4.4f};&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; var strings = values.OfType&lt;string&gt;();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; int top = 10;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; foreach (var s in strings)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  Label lbl = new Label();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  lbl.Top = top;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  top = top + 30;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  lbl.Text = s;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  this.Controls.Add(lbl);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You just copy the above code in to Form_Load and run the solution. There will be shown the string values.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2091750162905174481?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2091750162905174481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2091750162905174481' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2091750162905174481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2091750162905174481'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/05/what-is-oftype-operator-in-linq.html' title='What is OfType operator in LINQ?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5423758142293703805</id><published>2009-05-06T02:10:00.000-07:00</published><updated>2009-05-06T02:13:36.479-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Disable the Win Form’s Close Button using C#'/><title type='text'>How to disable the Win Form’s Close Button ?</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} h1 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:1; 	font-size:24.0pt; 	font-family:"Times New Roman";} span.articletoptitle 	{mso-style-name:articletoptitle;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;h1&gt;&lt;span class="articletoptitle"  style="font-size:85%;"&gt;&lt;span style=";font-family:Verdana;" &gt;Disable the Win Form’s Close Button using C#&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;Here is the simple way to disable the Form’s close button. Just copy the following code in your code behind. Then run the form, surely the close button would be disabled.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private const int CP_NOCLOSE_BUTTON = 0x200;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;protected override CreateParams CreateParams&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; get&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  CreateParams myCp = base.CreateParams;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  return myCp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5423758142293703805?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5423758142293703805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5423758142293703805' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5423758142293703805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5423758142293703805'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/05/how-to-disable-win-forms-close-button.html' title='How to disable the Win Form’s Close Button ?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-661381087296115167</id><published>2009-05-02T03:52:00.000-07:00</published><updated>2009-05-02T03:57:44.543-07:00</updated><title type='text'>Differences between XBAP, WPF Standalone and Silverlight</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Differences between XBAP, WPF Standalone and Silverlight&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;WPF applications are divided into two categories.&lt;br /&gt;&lt;br /&gt;•    Standalone WPF Application&lt;br /&gt;•    XAML browser applications (XBAPs)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There is always a confusion between WPF, XBAP and Silverlight. Developers get confused which one to go for while designing a project. Here I will explain all the 3 technologies with the differences&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Standalone WPF Application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; - WPF applications are installed on end user's machine.&lt;br /&gt;&lt;br /&gt; - Appear in Start Menu and Add/Remove Programs.&lt;br /&gt;&lt;br /&gt; - Applications can be installed via MSI or ClickOnce.&lt;br /&gt;&lt;br /&gt; - User can be offline and use the application. There is no need for Internet connection.&lt;br /&gt;&lt;br /&gt; - Newer versions of the application may not be automatically installed in user's machine.&lt;br /&gt;&lt;br /&gt; - WPF standalone applications can use WCF for communication.&lt;br /&gt;&lt;br /&gt; - Applications run in its own window as other windows applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;XAML Browser Application(XBAP)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; - These type of applications are not installed in user's machine.&lt;br /&gt;&lt;br /&gt; - They do not appear in the in Start Menu or Add/Remove Programs.&lt;br /&gt;&lt;br /&gt; - Applications can be automatically deployed via ClickOnce.&lt;br /&gt;&lt;br /&gt; - Applications are hosted in the browser process.&lt;br /&gt;&lt;br /&gt; - Can be run only in IE and Firefox.&lt;br /&gt;&lt;br /&gt; - Newer versions are always installed automatically into the user's machine.&lt;br /&gt;&lt;br /&gt; - User must be online to use the application.&lt;br /&gt;&lt;br /&gt; - XBAP is Windows only. We can run the application in Windows operating system only.&lt;br /&gt;&lt;br /&gt; - XBAPs cannot use WCF.&lt;br /&gt;&lt;br /&gt; - The user machine should have &lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;.NET framework 3.0&lt;/span&gt; components.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Silverlight&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; - XBAP is IE and Firefox only. But Silverlight can run in &lt;span style="font-weight: bold;"&gt;any browser and platform&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt; - Silverlight is used for creating rich UI &lt;span style="font-weight: bold;"&gt;web application&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt; - User's machine don't need .NET framework.&lt;br /&gt;&lt;br /&gt; - Can be embedded in HTML markup and rendered in any browser using the silverlight plug in.&lt;br /&gt;&lt;br /&gt; - XABP has 99% features of WPF. But Silverlight is just a subset of WPF.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-661381087296115167?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/661381087296115167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=661381087296115167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/661381087296115167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/661381087296115167'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/05/differences-between-xbap-wpf-standalone.html' title='Differences between XBAP, WPF Standalone and Silverlight'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5070224076287485800</id><published>2009-05-02T03:45:00.000-07:00</published><updated>2009-05-02T03:51:16.521-07:00</updated><title type='text'>XBAP - Windows Presentation Foundation XAML Browser Applications</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;XBAP - Windows Presentation Foundation XAML Browser Applications&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;XBAP – XAML Browser Application is a new windows technology used for creating Rich Internet Applications. It is used for creating heavyweight .Net applications.&lt;br /&gt;&lt;br /&gt;XAML Browser Applications combines features of both Web applications and rich-client applications. While windows applications are normally compiled to an &lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;.exe&lt;/span&gt; file, browser applications are compiled to an extension &lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;.xbap&lt;/span&gt; and can be run inside Internet Explorer.&lt;br /&gt;&lt;br /&gt;Like Web applications, XBAPs can be published to a Web server and launched from Internet Explorer. Like rich-client applications, XBAPs can take advantage of the capabilities of WPF. Developing XBAPs is also similar to rich-client development.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Implementing a XAML Browser Application (XBAP)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The simplest way to create a new XBAP project is with Microsoft Visual Studio:&lt;br /&gt;&lt;br /&gt;1.    On the File menu, point to New, and then click Project.&lt;br /&gt;2.    In the New Project dialog box, in the Project types pane, choose either Visual Basic or Visual&lt;br /&gt;        C#. In the Templates pane, click WPF Browser Application.&lt;br /&gt;3.    Assign a project name and click OK to create the new project.&lt;br /&gt;&lt;br /&gt;The WPF Browser Application project template creates an XBAP application project that includes the following:&lt;br /&gt;&lt;br /&gt;•    An application definition, Application.xaml.&lt;br /&gt;•    A page, Page1.xaml.&lt;br /&gt;&lt;br /&gt;You can add to those as required.&lt;br /&gt;&lt;br /&gt;If you prefer developing with tools that require command-line compilation.&lt;br /&gt;&lt;br /&gt;When you run an XBAP, it is launched in a browser window instead of a standalone window. When you debug an XBAP from Visual Studio, the application runs with Internet zone permission and will consequently throw security exceptions if those permissions are exceeded.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Deploying a XAML Browser Application &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you build a XBAP, the Microsoft build engine (MSBuild) produces the following three files as a minimum:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;•    An executable file. This contains the compiled code and has an .exe extension.&lt;br /&gt;•    An application manifest. This contains metadata associated with the application and has a&lt;br /&gt;      .manifest extension.&lt;br /&gt;•    A deployment manifest. This file contains the information that ClickOnce uses to deploy the&lt;br /&gt;      application and has an .xbap extension.&lt;br /&gt;&lt;br /&gt;You publish XBAPs to a Web server (Microsoft Internet Information Services (IIS) or later). You do not need to install .NET Framework on the Web server, but you do need to register the WPF Multipurpose Internet Mail Extensions (MIME) types and file extensions.&lt;br /&gt;&lt;br /&gt;To prepare your XBAP for deployment, copy the .exe and the associated manifests to your Web server. Create a hyperlink on a Web page to navigate to the deployment manifest. When the user clicks the link and navigates to the .xbap file, ClickOnce automatically handles the mechanics of downloading and launching the application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Reference: &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1.    &lt;a href="http://msdn.microsoft.com/en-us/library/aa970060.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa970060.aspx&lt;/a&gt;&lt;br /&gt;2.    &lt;a href="http://aspalliance.com/1824_Introduction_to_XAML_Browser_Applications_XBAP.1"&gt;http://aspalliance.com/1824_Introduction_to_XAML_Browser_Applications_XBAP.1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5070224076287485800?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5070224076287485800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5070224076287485800' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5070224076287485800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5070224076287485800'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/05/xbap-windows-presentation-foundation.html' title='XBAP - Windows Presentation Foundation XAML Browser Applications'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6918405022751061560</id><published>2009-04-28T22:33:00.000-07:00</published><updated>2009-04-28T22:39:54.103-07:00</updated><title type='text'>How to create Vista Gadget</title><content type='html'>We can create a Vista Sidebar Gadget by easily. Just follow the below steps then you are the owner of a sidebar gadget.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Step 1:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Create the following html file with the name of “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;HelloWorld.html&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_MTawyT4n2e4/Sffm9e6BoHI/AAAAAAAAA_Y/Fjy49Db6pd8/s1600-h/html.GIF"&gt;&lt;img style="cursor: pointer; width: 320px; height: 309px;" src="http://4.bp.blogspot.com/_MTawyT4n2e4/Sffm9e6BoHI/AAAAAAAAA_Y/Fjy49Db6pd8/s320/html.GIF" alt="" id="BLOGGER_PHOTO_ID_5329982627959119986" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Step 2:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Create the following xml file with the name of “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Gadget.xml&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_MTawyT4n2e4/SffnC4Op-II/AAAAAAAAA_g/U0Xx7emF6Pg/s1600-h/xml.GIF"&gt;&lt;img style="cursor: pointer; width: 320px; height: 301px;" src="http://2.bp.blogspot.com/_MTawyT4n2e4/SffnC4Op-II/AAAAAAAAA_g/U0Xx7emF6Pg/s320/xml.GIF" alt="" id="BLOGGER_PHOTO_ID_5329982720655882370" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Step 3:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Create a folder called &lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Helloworld.Gadget&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Step 4:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1.Simply copy”&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;%userprofile%\AppData\Local\Microsoft\Windows Sidebar\Gadgets&lt;/span&gt;” and paste in Windows explorer address bar.&lt;br /&gt;2. When you get to that folder Copy and Paste the “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;HelloWorld.Gadget&lt;/span&gt;” folder there.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Step 5:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Add the gadget to your Sidebar and your done !&lt;br /&gt;&lt;br /&gt;For more visit &lt;a href="http://archworx.wordpress.com/2006/11/05/how-to-create-a-vista-sidebar-gadget/"&gt;here … &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6918405022751061560?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6918405022751061560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6918405022751061560' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6918405022751061560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6918405022751061560'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/04/how-to-create-vista-gadget_28.html' title='How to create Vista Gadget'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MTawyT4n2e4/Sffm9e6BoHI/AAAAAAAAA_Y/Fjy49Db6pd8/s72-c/html.GIF' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7767808253681606242</id><published>2009-04-26T23:19:00.000-07:00</published><updated>2009-04-26T23:22:47.986-07:00</updated><title type='text'>How to get duration of an audio file in c# ?</title><content type='html'>We can get the duration of an audio or video file by using the “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Shell32&lt;/span&gt;” namespace in Visual Studio Dot Net. For that we need to add the reference of “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Interop.Shell32.dll&lt;/span&gt;” in to our project. And follow the given method in below. By calling the following method with the parameter of full path of file name which might be an audio file or video file we can get the duration of that file.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private string GetDuration(string FileFullPath)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            string duration = "";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            string fName = FileFullPath.Substring(FileFullPath.LastIndexOf("\\") + 1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            string filePath = FileFullPath.Substring(0, FileFullPath.LastIndexOf("\\"));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Shell32.Shell shell = new Shell32.ShellClass();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Shell32.Folder folder = shell.NameSpace(filePath);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Shell32.FolderItem folderItem = folder.ParseName(fName);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            if (folderItem != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                duration = folder.GetDetailsOf(folderItem, 21);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            folderItem = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            folder = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            shell = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            return duration;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csvinoth%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:595.45pt 841.7pt; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;Hence we can get the duration of given file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;…S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7767808253681606242?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7767808253681606242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7767808253681606242' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7767808253681606242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7767808253681606242'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/04/how-to-get-duration-of-audio-file-in-c.html' title='How to get duration of an audio file in c# ?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3908871815242286803</id><published>2009-04-20T22:20:00.000-07:00</published><updated>2009-05-08T04:39:49.889-07:00</updated><title type='text'>Find Age from given DateOfBirth using C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Just copy the following method in your class and call it with the parameters of date of birth and current date in DateTime format.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public string FindAge(DateTime dob, DateTime currentDate)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; int years = currentDate.Year - dob.Year;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; int months = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; int days = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if(currentDate &lt; dob.AddYears(Years) &amp;amp;&amp;amp; Years != 0)&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  --years;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; dob = dob.AddYears(years);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; if (dob.Year == currentDate.Year)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  months = currentDate.Month - dob.Month;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  months = (12 - dob.Month) + currentDate.Month;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if(currentDate &lt; dob.AddMonths(months) &amp;amp;&amp;amp; months != 0)&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  --months;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; dob = dob.AddMonths(months);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; days = (currentDate - dob).Days;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; return years + " years " + months + " months " + days + " days";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Copy the above code in your class...and call the method..enjoy... ;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3908871815242286803?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3908871815242286803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3908871815242286803' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3908871815242286803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3908871815242286803'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/04/find-age-from-given-dateofbirth-using-c.html' title='Find Age from given DateOfBirth using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6173440297921289427</id><published>2009-04-16T06:08:00.000-07:00</published><updated>2009-04-16T06:13:09.208-07:00</updated><title type='text'>Code for moving the form by mouse clicking.</title><content type='html'>Hi Viewers,&lt;br /&gt;&lt;br /&gt;Here by I am trying to give you a sample code for moving the win form by clicking the mouse.&lt;br /&gt;&lt;br /&gt;Just use the following code and test it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Runtime.InteropServices;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public const int WM_NCLBUTTONDOWN = 0xA1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public const int HT_CAPTION = 0x2;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;[DllImportAttribute("user32.dll")]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public static extern int SendMessage(IntPtr hWnd,int Msg, int wParam, int lParam);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;[DllImportAttribute("user32.dll")]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public static extern bool ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void Form1_MouseDown(object sender, MouseEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; if (e.Button == MouseButtons.Left)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now you can implement the above code in your application and test it. Working fine for me&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6173440297921289427?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6173440297921289427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6173440297921289427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6173440297921289427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6173440297921289427'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/04/code-for-moving-form-by-mouse-clicking.html' title='Code for moving the form by mouse clicking.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1657971699998710719</id><published>2009-04-16T05:57:00.001-07:00</published><updated>2009-04-16T06:02:26.886-07:00</updated><title type='text'>Add prerequisites of dotnet framework in visual studio setup project</title><content type='html'>When we developing an application using any platform we should prepare our application to be deployed properly. Specially for dotnet, the prerequisites of dotnet framework is must. So here by I am explaining how to add framework to be installed before our application installation process.&lt;br /&gt;&lt;br /&gt;After developing our .Net application we need to create a setup project. Just follow the steps mentioned in below.&lt;br /&gt;&lt;br /&gt;-    Go to &lt;span style="font-weight: bold;"&gt;File &lt;/span&gt;menu, select &lt;span style="font-weight: bold;"&gt;Add New Project &lt;/span&gt;and then select &lt;span style="font-weight: bold;"&gt;Setup And Deployment&lt;/span&gt; in under “&lt;span style="font-weight: bold;"&gt;Other Project Types&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;-    Give a name to your project as your wish.&lt;br /&gt;&lt;br /&gt;-    Then select your setup project solution and add &lt;span style="font-weight: bold;"&gt;Primary output&lt;/span&gt; of your developed project. You just need to right click your setup project in solution explorer, click &lt;span style="font-weight: bold;"&gt;add &lt;/span&gt;--&gt; &lt;span style="font-weight: bold;"&gt;Project Output&lt;/span&gt;  --&gt; select your project.&lt;br /&gt;&lt;br /&gt;-    Then add custom action by right clicking setup project --&gt; &lt;span style="font-weight: bold;"&gt;view &lt;/span&gt;--&gt; &lt;span style="font-weight: bold;"&gt;Custom Actions&lt;/span&gt; --&gt; right click &lt;span style="font-weight: bold;"&gt;Custom Actions&lt;/span&gt; --&gt; &lt;span style="font-weight: bold;"&gt;Add Custom Actions&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;-    Now we are going to add the &lt;span style="font-weight: bold;"&gt;prerequisites &lt;/span&gt;for your setup project.&lt;br /&gt;&lt;br /&gt;-    Select your setup project right click and go to &lt;span style="font-weight: bold;"&gt;properties &lt;/span&gt;then click the &lt;span style="font-weight: bold;"&gt;Prerequisites&lt;/span&gt; button.&lt;br /&gt;&lt;br /&gt;-    Now select &lt;span style="font-weight: bold;"&gt;.Net Framework 2.0&lt;/span&gt; tick box after selecting the “&lt;span style="font-weight: bold;"&gt;Create setup program to install prerequisite components&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;-    Then &lt;span style="font-weight: bold;"&gt;specify the install location for prerequisites&lt;/span&gt; by selecting the option box.&lt;br /&gt;&lt;br /&gt;-    Here I am selecting the second one “&lt;span style="font-weight: bold;"&gt;Download prerequisites from the same location as my application&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;-    Click &lt;span style="font-weight: bold;"&gt;ok &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;apply &lt;/span&gt;then &lt;span style="font-weight: bold;"&gt;ok&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;-    Now build your setup project, the dotnet framework will be added in your debug folder.&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1657971699998710719?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1657971699998710719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1657971699998710719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1657971699998710719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1657971699998710719'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/04/add-prerequisites-of-dotnet-framework.html' title='Add prerequisites of dotnet framework in visual studio setup project'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8289849056055600419</id><published>2009-03-31T05:58:00.000-07:00</published><updated>2009-03-31T06:01:47.218-07:00</updated><title type='text'>FileSystemWatcher in C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Here is the simple description to use FileSystemWatcher in your desktop application by using C#.&lt;br /&gt;&lt;br /&gt;Just drag the FileSystemWatcher control in your form from under the Components tab in the toolbox.&lt;br /&gt;&lt;br /&gt;And copy the following code in to load event,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void Form1_Load(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; fileSystemWatcher.Path = flvPath;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; fileSystemWatcher.Filter = "*.flv";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; fileSystemWatcher.NotifyFilter = NotifyFilters.FileName |  NotifyFilters.CreationTime | NotifyFilters.LastWrite;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; fileSystemWatcher.EnableRaisingEvents = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If the file watcher found any newly created file, the following event will rise.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void fileSystemWatcher_Created(object sender, FileSystemEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  MessageBox.Show(e.Name + " created in " + e.FullPath);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An event is rising when a file deleted.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void fileSystemWatcher_Deleted(object sender, FileSystemEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; MessageBox.Show(e.Name + " changed in " + e.FullPath);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An event is rising when a file renamed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; MessageBox.Show(e.Name + " renamed in " + e.FullPath);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That’s it…&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8289849056055600419?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8289849056055600419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8289849056055600419' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8289849056055600419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8289849056055600419'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/03/filesystemwatcher-in-c.html' title='FileSystemWatcher in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5069763048341296424</id><published>2009-03-31T05:07:00.000-07:00</published><updated>2009-03-31T05:12:40.069-07:00</updated><title type='text'>How to generate an xml from TreeView using C#?</title><content type='html'>Hi guys,&lt;br /&gt;&lt;br /&gt;Here is the sample code for generating xml file from TreeView. I needed this for one of my project. I just referred lot of sites and finally came to conclusion with the following code. Just copy and paste this code and use it for yours.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.IO;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private static StreamWriter sr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private void btnExportXML_Click(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   if (tvXML.Nodes.Count &gt; 0) &lt;span style="color: rgb(255, 255, 255);"&gt;// Here tvXML is TreeView control&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   {    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    sr = new StreamWriter(path); &lt;span style="color: rgb(255, 255, 255);"&gt;// Here path is xml path&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    sr.Write("&lt;" + tvXML.Nodes[0].Text + "&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    parseNode(tvXML.Nodes[0]);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    sr.Close();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;//Use the following method for getting value of each and every node&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private static void parseNode(TreeNode tn)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; IEnumerator ie = tn.Nodes.GetEnumerator();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; string parentnode = "";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; parentnode = tn.Text;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; while (ie.MoveNext())&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   TreeNode ctn = (TreeNode)ie.Current;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   if (ctn.GetNodeCount(true) == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    if (ctn.Tag != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;     sr.Write("&lt;" + ctn.Text + "&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;     sr.Write(ctn.Tag);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;     sr.Write("&lt;/" + ctn.Text + "&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;     sr.Write("&lt;" + ctn.Text + "/&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    sr.Write("&lt;" + ctn.Text + "&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   if (ctn.GetNodeCount(true) &gt; 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    parseNode(ctn);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  sr.Write("&lt;/" + parentnode + "&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  sr.WriteLine("");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5069763048341296424?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5069763048341296424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5069763048341296424' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5069763048341296424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5069763048341296424'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/03/how-to-generate-xml-from-treeview-using.html' title='How to generate an xml from TreeView using C#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-779679565153635364</id><published>2009-03-11T09:44:00.000-07:00</published><updated>2009-03-11T09:49:37.696-07:00</updated><title type='text'>How to bind Countries in a combobox using c#?</title><content type='html'>Find the code below to bind countries in a combo box using C#.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public void BindCountries()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures &amp;amp; ~CultureTypes.NeutralCultures))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                RegionInfo ri = new RegionInfo(ci.LCID);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                comboBox1.Items.Add(ri.EnglishName);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            comboBox1.Sorted = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            comboBox1.SelectedIndex = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-779679565153635364?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/779679565153635364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=779679565153635364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/779679565153635364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/779679565153635364'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/03/how-to-bind-countries-in-combobox-using.html' title='How to bind Countries in a combobox using c#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1262617696686800977</id><published>2009-02-11T04:04:00.000-08:00</published><updated>2009-02-11T04:31:31.429-08:00</updated><title type='text'>Using ClientScriptManager in C#</title><content type='html'>We know that we all are using the &lt;span style="font-weight: bold;"&gt;script&lt;/span&gt; tag for JavaScript function in our web page. In the case of some situations we need to add the scripts in code behind by dynamically. So .Net Framework 2.0 introduced a class namely &lt;span style="font-weight: bold;"&gt;“ClientScriptManager”&lt;/span&gt; that is used to manage script in code behind.&lt;br /&gt;&lt;br /&gt;Now we are going to about the ClientScriptManager class and its usage with some sample codes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ClientScriptManager:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This class is used to manage client scripts in .Net. We can get the object of this class from &lt;span style="color: rgb(255, 255, 153);"&gt;Page.ClientScript&lt;/span&gt;. We need to register the client script by using the method of RegisterClientScriptBlock () which is from that object of ClientScriptManager.&lt;br /&gt;&lt;br /&gt;The ClientScriptManager class uniquely identifies scripts by a key &lt;span style="color: rgb(255, 255, 153);"&gt;String&lt;/span&gt; and a &lt;span style="color: rgb(255, 255, 153);"&gt;Type&lt;/span&gt;. Scripts with the same key and type are considered duplicates. Using the script type helps to avoid confusing similar scripts from different user controls that might be in use on the page.&lt;br /&gt;&lt;br /&gt;The ClientScriptManager class can be used to invoke client callbacks in situations when it is desirable to run server code from the client without performing a postback. This is referred to as performing an out-of-band callback to the server. In a client callback, a client script function sends an asynchronous request to an ASP.NET Web page. The Web page runs a modified version of its normal life cycle to process the callback. Use the &lt;span style="font-weight: bold;"&gt;GetCallbackEventReference&lt;/span&gt; method to obtain a reference to a client function that, when invoked, initiates a client callback to a server event.&lt;br /&gt;&lt;br /&gt;       (This is from MSDN)&lt;br /&gt;&lt;br /&gt;Let we watch this in Code behind. Just use the following code in page load and run it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. RegisterClientScriptBlock()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Page_Load,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;protected void Page_Load(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Get the ClientScript property as an object of ClientScriptManager from Page object.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;ClientScriptManager client = this.Page.ClientScript;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Check the script block is not already registered&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if (!client.IsClientScriptBlockRegistered(this.GetType(), "Alert"))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;client.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Welcome !')", true);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. RegisterStartupScript()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;RegisterClientScriptBlock&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;RegisterStartupScript &lt;/span&gt;both the methods are using to fire during the startup of page. But the difference is that the RegisterClientScriptBlock method will fire the script &lt;span style="color: rgb(255, 255, 153);"&gt;“after the form open tag but before the page controls”&lt;/span&gt;. And the RegisterStartupScript method will fire the script&lt;span style="color: rgb(255, 255, 153);"&gt; “after page controls but before the form close tag”&lt;/span&gt;. So the first method won’t get the controls value in run time.&lt;br /&gt;&lt;br /&gt;For example, we are having a label box with the text “Vinoth” in a form, and then call the script as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;ClientScriptManager client = this.Page.ClientScript;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if (!client.IsStartupScriptRegistered(this.GetType(), "Alert"))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; client.RegisterStartupScript(this.GetType(), "Alert", "alert(document.getElementById('lblName.Text'))", true);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1262617696686800977?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1262617696686800977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1262617696686800977' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1262617696686800977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1262617696686800977'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/02/using-clientscriptmanager-in-c.html' title='Using ClientScriptManager in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3645937489261605813</id><published>2009-02-02T04:24:00.000-08:00</published><updated>2009-02-02T04:25:24.628-08:00</updated><title type='text'>How do I change the color of the title bar in a Win Forms .Net app using c#?</title><content type='html'>We can use the WM_NCPAINT Message to do that. We must have to code for override the WndProc method to change the color of title bar in a Win Forms. Here I have done that with the following code. You can do that by using the code below.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Runtime.InteropServices;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;[DllImport("user32.dll")]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;static extern int ReleaseDC(IntPtr hWnd, IntPtr hDc);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;[DllImport("User32.dll")]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private static extern IntPtr GetWindowDC(IntPtr hWnd);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;protected override void WndProc(ref Message m)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; base.WndProc(ref m);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; const int WM_NCPAINT = 0x85;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; if (m.Msg == WM_NCPAINT)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  IntPtr hdc = GetWindowDC(m.HWnd);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  if ((int)hdc != 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    Graphics g = Graphics.FromHdc(hdc);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    g.FillRectangle(Brushes.Green,new Rectangle(0,0,300,22));                    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    g.Flush();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    ReleaseDC(m.HWnd, hdc);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  } &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That’s it…&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;…S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3645937489261605813?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3645937489261605813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3645937489261605813' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3645937489261605813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3645937489261605813'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/02/how-do-i-change-color-of-title-bar-in.html' title='How do I change the color of the title bar in a Win Forms .Net app using c#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7105845761545267188</id><published>2009-01-30T04:39:00.000-08:00</published><updated>2009-01-30T04:49:43.779-08:00</updated><title type='text'>Creating a database with filestream using (C#) SMO in DotNet 3.5.</title><content type='html'>The following code will help you to do the creating database with filestream.&lt;br /&gt;&lt;br /&gt;Here am using the SMO from Visual Studio Dot Net 3.5. Smo object is very useful to do the sqlserver manipulations from code end. However we could create a db with filestream. Just go thru the following code and use it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using Microsoft.SqlServer.Management.Smo;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string dbName = "DBName";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string dbServerMachineName = "MachineName";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string mdfFile = mdfDirectory+@"\" + dbName + ".mdf";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string ldfFile = ldfDirectory + @"\" + dbName + "_log.ldf";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string FilesDir = FilesDirectory +@"\" + dbName;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(dbServerMachineName);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Database database = new Database(server, dbName);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Adding Primary FileGroup&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.FileGroups.Add(new FileGroup(database, "PRIMARY"));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Adding FileStream FileGroup&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.FileGroups.Add(new FileGroup(database, "FileStreamTest", true));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Adding Files for Primary FileGroup&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;DataFile dtPrimary = new DataFile(database.FileGroups["PRIMARY"], "PriValue", mdfFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;dtPrimary.Size = 77.0 * 1024.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;dtPrimary.GrowthType = FileGrowthType.KB;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;dtPrimary.Growth = 1.0 * 1024.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.FileGroups["PRIMARY"].Files.Add(dtPrimary);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Adding Files for FileStream FileGroup&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.FileGroups["FileStreamTest "].Files.Add(new DataFile(database.FileGroups["FileStreamTest "], " FileStreamTest Values", FilesDir));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Adding LogFile&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;LogFile logFile = new LogFile(database, "PriValue_log", ldfFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;logFile.Size = 7.0 * 1024.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;logFile.GrowthType = FileGrowthType.Percent;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;logFile.Growth = 10.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.LogFiles.Add(logFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Create database.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.Create();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.Refresh();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7105845761545267188?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7105845761545267188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7105845761545267188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7105845761545267188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7105845761545267188'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/creating-database-with-filestream-using.html' title='Creating a database with filestream using (C#) SMO in DotNet 3.5.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2257721751576424656</id><published>2009-01-27T05:07:00.000-08:00</published><updated>2009-01-30T05:06:11.330-08:00</updated><title type='text'>How to restore a DataBase from .bak file using (C#) SMO in DotNet 3.5?</title><content type='html'>The following code will help you to do this restore processing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using Microsoft.SqlServer.Management.Smo;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string backupFile="Backupfile";//.bak file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string dbName = "DBName";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string dbServerMachineName = "MachineName";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(dbServerMachineName);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Database database = new Database(server, dbName);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//If Need&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.Create();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.Refresh();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Restoring&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Restore restore = new Restore();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.NoRecovery = false;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.Action = RestoreActionType.Database;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;BackupDeviceItem bdi = default(BackupDeviceItem);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;bdi = new BackupDeviceItem(backupFile, DeviceType.File);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.Devices.Add(bdi);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.Database = dbName;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.ReplaceDatabase = true;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.PercentCompleteNotification = 10;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;restore.SqlRestore(server);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.Refresh();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;database.SetOnline();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;server.Refresh();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2257721751576424656?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2257721751576424656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2257721751576424656' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2257721751576424656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2257721751576424656'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/how-to-restore-database-from-bak-file.html' title='How to restore a DataBase from .bak file using (C#) SMO in DotNet 3.5?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6676330240260505620</id><published>2009-01-27T04:00:00.000-08:00</published><updated>2009-01-30T05:08:34.146-08:00</updated><title type='text'>How to taking backup a database using (c#) DotNet framework 3.5? Or using SMO?</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(204, 204, 204);"&gt;How to taking backup a database using (c#) DotNet framework 3.5? Or using SMO?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Add the following reference in your project for using SMO through “&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;Add Reference&lt;/span&gt;”.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;- Microsoft.SqlServer.ConnectionInfo&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;- Microsoft.SqlServer.Management.Sdk.Sfc&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;- Microsoft.SqlServer.Smo&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;- Microsoft.SqlServer.SmoExtended&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 255);"&gt;- Microsoft.SqlServer.SqlEnum&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, you can use the following code for taking backup of given database using SMO.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Collections.Generic;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Linq;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.Text;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using System.IO;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using Microsoft.SqlServer.Management.Smo;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string MachineName="Your MachineName";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string DBName="Your DBName";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string backupName = "tempBackup";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(MachineName);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Database db = server.Databases[DBName];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//To Avoid TimeOut Exception&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;server.ConnectionContext.StatementTimeout = 60 * 60;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;RecoveryModel recoverymodel = db.DatabaseOptions.RecoveryModel;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Define a Backup object variable.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Backup backup = new Backup();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.CompressionOption = BackupCompressionOptions.On;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Specify the type of backup, the description, the name, and the database to be backed up.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.Action = BackupActionType.Database;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.BackupSetDescription = "Full backup of " + DBName + ".";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.BackupSetName = backupName;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.Database = DBName;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Declare a BackupDeviceItem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;BackupDeviceItem bdi = default(BackupDeviceItem);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;bdi = new BackupDeviceItem(@"C:\ " + backupName + ".bak", DeviceType.File);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Add the device to the Backup object.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.Devices.Add(bdi);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Set the Incremental property to False to specify that this is a full database backup.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.Incremental = false;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Set the expiration date.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;System.DateTime backupdate = new System.DateTime();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backupdate = new System.DateTime(2008, 10, 5);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.ExpirationDate = backupdate;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Specify that the log must be truncated after the backup is complete.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.LogTruncation = BackupTruncateLogType.Truncate;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Run SqlBackup to perform the full database backup on the instance of SQL Server.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.SqlBackup(server);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;//Remove the backup device from the Backup object.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;backup.Devices.Remove(bdi);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6676330240260505620?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6676330240260505620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6676330240260505620' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6676330240260505620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6676330240260505620'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/how-to-taking-backup-database-using-c.html' title='How to taking backup a database using (c#) DotNet framework 3.5? Or using SMO?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1864346379153680963</id><published>2009-01-26T23:41:00.000-08:00</published><updated>2009-01-30T05:13:38.580-08:00</updated><title type='text'>How to write entry in EventViewer using C#?</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Just copy the following method in your project and call that method. It will write an entry in your EventViewer.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public void testEventLogEntry()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;if (!System.Diagnostics.EventLog.SourceExists("MyTest.WinService"))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;System.Diagnostics.EventLog.CreateEventSource(&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;"MyTest.WinService", "Application");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;eventLog.Source = "MyTest.WinService";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;eventLog.WriteEntry("Test");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1864346379153680963?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1864346379153680963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1864346379153680963' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1864346379153680963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1864346379153680963'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/how-to-write-entry-in-eventviewer-using.html' title='How to write entry in EventViewer using C#?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-144803545882139662</id><published>2009-01-09T07:18:00.000-08:00</published><updated>2009-01-30T05:15:30.796-08:00</updated><title type='text'>How to get BitmapSource from System.Drawing.Bitmap in C#  3.5</title><content type='html'>&lt;span style="color: rgb(255, 255, 204);"&gt;public BitmapSource getBitmapSourceFromBitmap(Bitmap bmp)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;BitmapSource returnSource = null;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;returnSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(),&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;catch { returnSource = null; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;return returnSource;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-144803545882139662?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/144803545882139662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=144803545882139662' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/144803545882139662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/144803545882139662'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/how-to-get-bitmapsource-from.html' title='How to get BitmapSource from System.Drawing.Bitmap in C#  3.5'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3986934642042507285</id><published>2009-01-09T07:01:00.000-08:00</published><updated>2009-01-30T05:10:39.787-08:00</updated><title type='text'>Getting Bitmap from Base64String in C#</title><content type='html'>Use the following code for getting Bitmap from Base64String.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public Bitmap getBitmapFromBase64String(string base64Value)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Bitmap img = null;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;byte[] imgData = Convert.FromBase64String(base64Value);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;using (MemoryStream ms = new MemoryStream())&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;ms.Write(imgData, 0, imgData.Length);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;img = (Bitmap)Image.FromStream(ms, true);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;ms.Close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;ms.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;return img;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;....S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3986934642042507285?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3986934642042507285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3986934642042507285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3986934642042507285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3986934642042507285'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/getting-bitmap-from-base64string-in-c.html' title='Getting Bitmap from Base64String in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3186846171533368310</id><published>2009-01-09T06:13:00.000-08:00</published><updated>2009-01-09T06:14:40.530-08:00</updated><title type='text'>Displaying an Image in an aspx page as OutputStream using C#</title><content type='html'>Dear Viewers,&lt;br /&gt;&lt;br /&gt;Here am going to give a solution to display an image in an aspx page as OutputStream by using c#.&lt;br /&gt;&lt;br /&gt;First of all we need to remove all code in that aspx except the line of page tag (i.e., &lt;span style="color: rgb(255, 255, 204);"&gt;&lt;%@ Page Language="C#"&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;In Page_Load&lt;br /&gt;&lt;br /&gt;Do the code behind as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Response.ContentType = "image/jpeg";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;System.Drawing.Image img = System.Drawing.Image.FromFile(@"C:\test.jpg");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yes, this the way to save image in aspx page as OutputStream.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3186846171533368310?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3186846171533368310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3186846171533368310' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3186846171533368310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3186846171533368310'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/displaying-image-in-aspx-page-as.html' title='Displaying an Image in an aspx page as OutputStream using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3979913943305064846</id><published>2009-01-09T05:42:00.000-08:00</published><updated>2009-01-09T05:45:49.183-08:00</updated><title type='text'>Getting Images from FTP using C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Here the sample for getting an Image from ftp file path using C#.&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CTFSSER%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C04%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; System.Net;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; path = "ftp://dev-ftp.test.com/" + folderName + "\\" + fileName;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;FtpWebRequest&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; ftp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri(path));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ftp.Credentials = new NetworkCredential(username, password);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ftp.Method = WebRequestMethods.Ftp.DownloadFile;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; (FtpWebResponse response = (FtpWebResponse)ftp.GetResponse())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt; &lt;/span&gt;using (Stream responseStream = response.GetResponseStream())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;using (FileStream fs = new FileStream(localPath+fileName, FileMode.Create))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;byte[] buffer = new byte[102400];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;int read = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;   &lt;/span&gt;read = responseStream.Read(buffer, 0, buffer.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;   &lt;/span&gt;fs.Write(buffer, 0, read);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;   &lt;/span&gt;fs.Flush();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;} while (!(read == 0));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;fs.Flush();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;fs.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;  &lt;/span&gt;response.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  responseStream.Close();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;Hence we can save an image in to our local file path from ftp file path.&lt;br /&gt;&lt;br /&gt;That's it....&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3979913943305064846?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3979913943305064846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3979913943305064846' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3979913943305064846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3979913943305064846'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2009/01/getting-images-from-ftp-using-c.html' title='Getting Images from FTP using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8717331931576690093</id><published>2008-12-08T22:17:00.000-08:00</published><updated>2009-01-30T05:20:39.972-08:00</updated><title type='text'>Difference between &lt;% %&gt;, &lt;%= %&gt;, &lt;%# %&gt;?</title><content type='html'>Whenever we are going to write code inside the &lt;% %&gt; then that piece of code will treated as server side code generally vbscript.&lt;br /&gt;&lt;br /&gt;When we are accessing any server side variable into the HTML (in .aspx) side then we use &lt;%= %&gt;.&lt;br /&gt;&lt;br /&gt;When we are using any binding control like repeater, gridview… etc then to bind the particular column with the database value then we are using &lt;%# %&gt; when the Autogenerate column of the binding controls are FALSE&lt;br /&gt;&lt;br /&gt;For Example:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Text='&lt;%#Eval("FirstName") %&gt;' this tag put inside the Text property of the control inside the datagrid like (textbox, label etc....)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8717331931576690093?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8717331931576690093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8717331931576690093' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8717331931576690093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8717331931576690093'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/12/difference-between.html' title='Difference between &lt;% %&gt;, &lt;%= %&gt;, &lt;%# %&gt;?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1188709877206278012</id><published>2008-12-08T22:11:00.000-08:00</published><updated>2008-12-08T22:13:59.022-08:00</updated><title type='text'>Image Resizing by WPF: Using System.Windows.Media.Imaging;</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;Here is the example of getting &lt;b style=""&gt;resized image&lt;/b&gt; by using &lt;b style=""&gt;Imaging&lt;/b&gt; namespace in &lt;b style=""&gt;DotNet 3.0&lt;/b&gt;.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Same three reference need to add for resizing the image also. PresentationCore, WindowsBase and PresentationFramework.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; ResizeImage(&lt;span style="color:blue;"&gt;string&lt;/span&gt; SourceImagePath, &lt;span style="color:blue;"&gt;string&lt;/span&gt; ImageType, &lt;span style="color:blue;"&gt;string&lt;/span&gt; TargetImagePath, &lt;span style="color:blue;"&gt;int&lt;/span&gt; decodePixelWidth, &lt;span style="color:blue;"&gt;int&lt;/span&gt; decodePixelHeight)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;newWidth = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;newHeight = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;getResizableHeightWidth(SourceImagePath, decodePixelWidth, decodePixelHeight);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;&lt;span style=""&gt; &lt;/span&gt;byte&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;[] imageBytes = LoadImageData(SourceImagePath);&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:green;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;ImageSource&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; imageSource = CreateResizedImage(imageBytes, newWidth,&lt;span style=""&gt;  &lt;/span&gt;newHeight);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;imageBytes = GetEncodedImageData(imageSource, ImageType);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;SaveImageData(imageBytes, TargetImagePath);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;LoadImageData, GetEncodedImageData and SaveImageData methods are given in last post. Here the CreateResizedImage method is given in below.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for getting resized image by given image data byte array with width and height.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;ImageSource&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; CreateResizedImage(&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imageData, &lt;span style="color:blue;"&gt;int&lt;/span&gt; width, &lt;span style="color:blue;"&gt;int&lt;/span&gt; height)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BitmapImage&lt;/span&gt; bmpImage = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapImage&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bmpImage.BeginInit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (width &gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;bmpImage.DecodePixelWidth = width;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (height &gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;bmpImage.DecodePixelHeight = height;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bmpImage.StreamSource = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;MemoryStream&lt;/span&gt;(imageData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bmpImage.CreateOptions = &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapCreateOptions&lt;/span&gt;.None;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bmpImage.CacheOption = &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapCacheOption&lt;/span&gt;.OnLoad;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bmpImage.EndInit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Rect&lt;/span&gt; rect = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Rect&lt;/span&gt;(0, 0, width, height);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;DrawingVisual&lt;/span&gt; drawingVisual = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DrawingVisual&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;using&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;DrawingContext&lt;/span&gt; drawingContext = drawingVisual.RenderOpen())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;drawingContext.DrawImage(bmpImage, rect);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;RenderTargetBitmap&lt;/span&gt; resizedImage = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;RenderTargetBitmap&lt;/span&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;(&lt;span style="color:blue;"&gt;int&lt;/span&gt;)rect.Width, (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)rect.Height,&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:green;"&gt;// Resized dimensions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;96, 96,&lt;span style=""&gt;                             &lt;/span&gt;&lt;span style="color:green;"&gt;// Default DPI values&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;PixelFormats&lt;/span&gt;.Default);&lt;span style=""&gt;              &lt;/span&gt;&lt;span style="color:green;"&gt;// Default pixel format&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;resizedImage.Render(drawingVisual);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; resizedImage;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;span style="font-family: verdana;font-family:&amp;quot;;font-size:85%;"  &gt;}&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:595.45pt 841.7pt; 	margin:.8in .8in .5in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for getting resizable height and width by given height and width.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; getResizableHeightWidth(&lt;span style="color:blue;"&gt;string&lt;/span&gt; ImagePath, &lt;span style="color:blue;"&gt;int&lt;/span&gt; maxWidth, &lt;span style="color:blue;"&gt;int&lt;/span&gt; maxHeight)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;System.Drawing.&lt;span style="color: rgb(43, 145, 175);"&gt;Image&lt;/span&gt; image = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Bitmap&lt;/span&gt;(ImagePath);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;int&lt;/span&gt; width = image.Width;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;int&lt;/span&gt; height = image.Height;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;&lt;span style=""&gt; &lt;/span&gt;double&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; widthFactor = (&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(width) / &lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(maxWidth));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;double&lt;/span&gt; heightFactor = (&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(height) /&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(maxHeight));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;newWidth=0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;newHeight=0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;&lt;span style=""&gt; &lt;/span&gt;if&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; (widthFactor &gt; heightFactor)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newWidth = &lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(width) / widthFactor);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newHeight = &lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(height) / widthFactor);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newWidth = &lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(width) / heightFactor);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newHeight = &lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color: rgb(43, 145, 175);"&gt;Convert&lt;/span&gt;.ToDouble(height) / heightFactor);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (newHeight == 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newHeight = 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (newWidth == 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;newWidth = 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;That’s it.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1188709877206278012?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1188709877206278012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1188709877206278012' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1188709877206278012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1188709877206278012'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/12/image-resizing-by-wpf-using.html' title='Image Resizing by WPF: Using System.Windows.Media.Imaging;'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7800152684621238776</id><published>2008-12-08T22:06:00.000-08:00</published><updated>2008-12-08T22:09:56.716-08:00</updated><title type='text'>Image Cropping by WPF: Using System.Windows.Media.Imaging;</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;Introducing &lt;b style=""&gt;System.Windows.Media.Imaging&lt;/b&gt; namespace provides types that are used to encode and decode bitmap images.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Here I am going to explain a sample application which is used to cropping images. Imaging namespace is in under Windows Presentation Foundation will do the image manipulation in simple manner.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Wingdings; 	panose-1:5 0 0 0 0 0 0 0 0 0; 	mso-font-charset:2; 	mso-generic-font-family:auto; 	mso-font-pitch:variable; 	mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:555314709; 	mso-list-type:hybrid; 	mso-list-template-ids:-1727885570 -1091284804 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 	{mso-level-start-at:0; 	mso-level-number-format:bullet; 	mso-level-text:-; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;First of all, we need to add the following reference in our project.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=""&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;PresentationCore&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=""&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;PresentationFramework&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=""&gt;&lt;span style=""&gt;-&lt;span style=";font-family:&amp;quot;;font-size:7;"  &gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;WindowsBase&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Then use the following namespace,&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;using&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; System.Windows.Media;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;using&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; System.Windows.Media.Imaging;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;The method for creating crop images with passing appropriate parameters as follows,&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for Creating Crop Image&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; CreateCropImage(&lt;span style="color:blue;"&gt;int&lt;/span&gt; x, &lt;span style="color:blue;"&gt;int&lt;/span&gt; y, &lt;span style="color:blue;"&gt;int&lt;/span&gt; width, &lt;span style="color:blue;"&gt;int&lt;/span&gt; height, &lt;span style="color:blue;"&gt;string&lt;/span&gt; SourceImagePath, &lt;span style="color:blue;"&gt;string&lt;/span&gt; TargetImagePath, &lt;span style="color:blue;"&gt;string&lt;/span&gt; ImageType)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{ &lt;span style="color:green;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imgBytest = LoadImageData(SourceImagePath);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;System.Drawing.&lt;span style="color: rgb(43, 145, 175);"&gt;Image&lt;/span&gt; img=&lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Bitmap&lt;/span&gt;(SourceImagePath);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CroppedBitmap&lt;/span&gt; cb = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;CroppedBitmap&lt;/span&gt;((&lt;span style="color: rgb(43, 145, 175);"&gt;BitmapSource&lt;/span&gt;)CreateImage(imgBytest,img.Width,img.Height), &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Int32Rect&lt;/span&gt;(x, y, width, height));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;ImageSource&lt;/span&gt; imageSource = cb;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imageBytes = GetEncodedImageData(imageSource, ImageType);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;   &lt;/span&gt;SaveImageData(imageBytes, TargetImagePath);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for getting image bytes from image's source path by using FileStream.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] LoadImageData(&lt;span style="color:blue;"&gt;string&lt;/span&gt; filePath)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt; fs = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt;(filePath, &lt;span style="color: rgb(43, 145, 175);"&gt;FileMode&lt;/span&gt;.Open, &lt;span style="color: rgb(43, 145, 175);"&gt;FileAccess&lt;/span&gt;.Read);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BinaryReader&lt;/span&gt; br = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BinaryReader&lt;/span&gt;(fs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imageBytes = br.ReadBytes((&lt;span style="color:blue;"&gt;int&lt;/span&gt;)fs.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;br.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;fs.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; imageBytes;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for getting cropped image.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ImageSource&lt;/span&gt; CreateImage(&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imageData, &lt;span style="color:blue;"&gt;int&lt;/span&gt; decodePixelWidth, &lt;span style="color:blue;"&gt;int&lt;/span&gt; decodePixelHeight)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (imageData == &lt;span style="color:blue;"&gt;null&lt;/span&gt;) &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BitmapImage&lt;/span&gt; result = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapImage&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;result.BeginInit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (decodePixelWidth &gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;result.DecodePixelWidth = decodePixelWidth;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (decodePixelHeight &gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;result.DecodePixelHeight = decodePixelHeight;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;result.StreamSource = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;MemoryStream&lt;/span&gt;(imageData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;result.CreateOptions = &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapCreateOptions&lt;/span&gt;.None;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;result.CacheOption = &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapCacheOption&lt;/span&gt;.OnLoad;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;result.EndInit();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; result;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for getting encoded image data for the cropped image.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;internal&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] GetEncodedImageData(&lt;span style="color: rgb(43, 145, 175);"&gt;ImageSource&lt;/span&gt; image, &lt;span style="color:blue;"&gt;string&lt;/span&gt; preferredFormat)&lt;span style="color:green;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] returnData = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BitmapEncoder&lt;/span&gt; encoder = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;switch&lt;/span&gt; (preferredFormat.ToLower())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".jpg"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".jpeg"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;JpegBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".bmp"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BmpBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".png"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;PngBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".tif"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".tiff"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;TiffBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".gif"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;GifBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;case&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;".wmp"&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;WmpBitmapEncoder&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (image &lt;span style="color:blue;"&gt;is&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapSource&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;MemoryStream&lt;/span&gt; stream = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;MemoryStream&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder.Frames.Add(&lt;span style="color: rgb(43, 145, 175);"&gt;BitmapFrame&lt;/span&gt;.Create(image &lt;span style="color:blue;"&gt;as&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BitmapSource&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;encoder.Save(stream);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;stream.Seek(0, &lt;span style="color: rgb(43, 145, 175);"&gt;SeekOrigin&lt;/span&gt;.Begin);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;returnData = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color:blue;"&gt;byte&lt;/span&gt;[stream.Length];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BinaryReader&lt;/span&gt; br = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BinaryReader&lt;/span&gt;(stream);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;br.Read(returnData, 0, (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)stream.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;br.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt;  &lt;/span&gt;stream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; returnData;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:green;"  &gt;//Method for saving the image data as image in to spec&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;private&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SaveImageData(&lt;span style="color:blue;"&gt;byte&lt;/span&gt;[] imageData, &lt;span style="color:blue;"&gt;string&lt;/span&gt; filePath)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt; fs = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt;(filePath, &lt;span style="color: rgb(43, 145, 175);"&gt;FileMode&lt;/span&gt;.Create, &lt;span style="color: rgb(43, 145, 175);"&gt;FileAccess&lt;/span&gt;.Write);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BinaryWriter&lt;/span&gt; bw = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BinaryWriter&lt;/span&gt;(fs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bw.Write(imageData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;bw.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style=""&gt; &lt;/span&gt;fs.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;span style="font-family: verdana;font-family:&amp;quot;;font-size:85%;"  &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;That's it...&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7800152684621238776?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7800152684621238776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7800152684621238776' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7800152684621238776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7800152684621238776'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/12/image-cropping-by-wpf-using.html' title='Image Cropping by WPF: Using System.Windows.Media.Imaging;'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4448291313246999920</id><published>2008-11-26T12:40:00.000-08:00</published><updated>2008-11-26T12:46:54.696-08:00</updated><title type='text'>Windows Presentation Foundation.</title><content type='html'>I think all of you getting pretty confusion why need to explain about &lt;span style="font-weight: bold;"&gt;WPF &lt;/span&gt;cause of lot explanation available in more pages.  Actually I am going to post some &lt;span style="font-weight: bold;"&gt;Image manipulation&lt;/span&gt; functionalism in upcoming posts. So here is the introduction to &lt;span style="font-weight: bold;"&gt;WPF&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"&gt;&lt;/o:smarttagtype&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if !mso]&gt;&lt;object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"&gt;&lt;/object&gt; &lt;style&gt; st1\:*{behavior:url(#ieooui) } &lt;/style&gt; &lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;The Windows Presentation Foundation is a Graphical subsystem in .Net Framework 3.0 which uses a markup language, known as XAML for rich user interface development. WPF formerly code named Avalon. WCF – Indigo, CardSpace – InfoCard, WF – WorkFlow. WPF is included with &lt;b style=""&gt;Windows &lt;st1:place st="on"&gt;Vista&lt;/st1:place&gt;,&lt;/b&gt; &lt;b style=""&gt;Windows Server 2008&lt;/b&gt;, &lt;b style=""&gt;Windows XP Service Pack 2&lt;/b&gt; or later and &lt;b style=""&gt;Windows Server 2003&lt;/b&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;It provides a clear separation between the &lt;b style=""&gt;&lt;span style="text-decoration: none;color:#000000;" &gt;user interface&lt;/span&gt;&lt;/b&gt; and the &lt;b style=""&gt;&lt;span style="text-decoration: none;color:#000000;" &gt;business logic&lt;/span&gt;&lt;/b&gt;. A WPF application can be deployed on the desktop or hosted in a web browser. So we can create a wide range of both standalone and browser-hosted applications.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;It aims to unify a number of application services: user interface, 2D and 3D drawing, fixed and adaptive &lt;span style="text-decoration: none;color:#000000;" &gt;documents&lt;/span&gt;, advanced &lt;span style="text-decoration: none;color:#000000;" &gt;typography&lt;/span&gt;, &lt;span style="text-decoration: none;color:#000000;" &gt;vector graphics&lt;/span&gt;, &lt;span style="text-decoration: none;color:#000000;" &gt;raster graphics&lt;/span&gt;, &lt;span style="text-decoration: none;color:#000000;" &gt;animation&lt;/span&gt;, &lt;span style="text-decoration: none;color:#000000;" &gt;data binding&lt;/span&gt;, &lt;span style="text-decoration: none;color:#000000;" &gt;audio&lt;/span&gt; and &lt;span style="text-decoration: none;color:#000000;" &gt;video&lt;/span&gt;.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;Some examples are &lt;b style=""&gt;&lt;span style="text-decoration: none;color:#000000;" &gt;Yahoo! Messenger&lt;/span&gt;&lt;/b&gt; and the &lt;b style=""&gt;&lt;span style="text-decoration: none;color:#000000;" &gt;New York Times Reader&lt;/span&gt;&lt;/b&gt;, as well as the &lt;b style=""&gt;&lt;span style="text-decoration: none;color:#000000;" &gt;Contoso Healthcare Sample Application&lt;/span&gt;&lt;/b&gt;. WPF is included in the Microsoft .NET Framework, so you can build applications that incorporate other elements of the .NET Framework class library.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;I hope this will make you some ideas in &lt;span style="font-weight: bold;"&gt;WPF&lt;/span&gt;. Let we stop the introduction of WPF from here.&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-align: justify; text-indent: 0.5in;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4448291313246999920?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4448291313246999920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4448291313246999920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4448291313246999920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4448291313246999920'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/windows-presentation-foundation.html' title='Windows Presentation Foundation.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4435414056982822699</id><published>2008-11-26T12:34:00.000-08:00</published><updated>2008-11-26T12:36:40.265-08:00</updated><title type='text'>Image Resize using C#.</title><content type='html'>Use the following method to resize an image.&lt;br /&gt;&lt;br /&gt;       &lt;span style="color: rgb(255, 255, 204);"&gt; public Image ResizeImage(Image image, int maxWidth, int maxHeight)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            if (image == null)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                return image;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            int width = image.Width;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            int height = image.Height;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            double widthFactor = (Convert.ToDouble(width) / Convert.ToDouble(maxWidth));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            double heightFactor = (Convert.ToDouble(height) / Convert.ToDouble(maxHeight));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            if (widthFactor &lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                // Skip resize&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                return image;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                int newWidth;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                int newHeight;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                if (widthFactor &gt; heightFactor)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newWidth = Convert.ToInt32(Convert.ToDouble(width) / widthFactor);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newHeight = Convert.ToInt32(Convert.ToDouble(height) / widthFactor);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newWidth = Convert.ToInt32(Convert.ToDouble(width) / heightFactor);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newHeight = Convert.ToInt32(Convert.ToDouble(height) / heightFactor);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                if (newHeight == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newHeight = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                if (newWidth == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    newWidth = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                Bitmap bitmap = new Bitmap(newWidth, newHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                bitmap.SetResolution(96, 96);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                Graphics graphics = Graphics.FromImage(bitmap);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                graphics.DrawImage(image, 0, 0, newWidth, newHeight);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                image.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                return bitmap;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4435414056982822699?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4435414056982822699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4435414056982822699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4435414056982822699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4435414056982822699'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/image-resize-using-c.html' title='Image Resize using C#.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3498509962750283547</id><published>2008-11-26T12:27:00.000-08:00</published><updated>2008-11-26T12:29:25.521-08:00</updated><title type='text'>Bytes to GB MB Conversion using C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Just copy the following method to getting file size with GB or MB formatted.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;private string GetFileSize(long Bytes)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    if (Bytes &gt;= 1073741824)   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {       &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        Decimal size = Decimal.Divide(Bytes, 1073741824);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return String.Format("{0:##.##} GB", size);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    else if (Bytes &gt;= 1048576)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {        Decimal size = Decimal.Divide(Bytes, 1048576);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return String.Format("{0:##.##} MB", size);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    else if (Bytes &gt;= 1024)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {        Decimal size = Decimal.Divide(Bytes, 1024);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return String.Format("{0:##.##} KB", size);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    else if (Bytes &gt; 0 &amp;amp; Bytes &lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {        Decimal size = Bytes;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return String.Format("{0:##.##} Bytes", size);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return "0 Bytes";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3498509962750283547?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3498509962750283547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3498509962750283547' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3498509962750283547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3498509962750283547'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/bytes-to-gb-mb-conversion-using-c.html' title='Bytes to GB MB Conversion using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4576282314548970597</id><published>2008-11-21T01:34:00.000-08:00</published><updated>2008-11-21T01:35:39.422-08:00</updated><title type='text'>Cropping Image</title><content type='html'>Use the following code to crop an image by C#.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;  public Image CropImage(Image img, int cropLeft, int cropTop, int cropWidth, int cropHeight)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Bitmap bmp = new Bitmap(img);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Rectangle rect = new Rectangle(cropLeft, cropTop, cropWidth, cropHeight);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            Bitmap croppedBmp = bmp.Clone(rect, bmp.PixelFormat);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            return croppedBmp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;....S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4576282314548970597?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4576282314548970597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4576282314548970597' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4576282314548970597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4576282314548970597'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/cropping-image.html' title='Cropping Image'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6831129116589455502</id><published>2008-11-21T01:23:00.000-08:00</published><updated>2008-11-21T01:31:49.363-08:00</updated><title type='text'>Cropping an Image with best quality using C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Here is the sample code for getting cropped image with the best quality. Try it out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;public Image CropImage(Image img, int left, int top, int width, int height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    try&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        bmp.SetResolution(80, 60);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        Graphics graphics = Graphics.FromImage(bmp);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        graphics.SmoothingMode = SmoothingMode.AntiAlias;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        graphics.DrawImage(img, new Rectangle(0, 0, width, height), left, top, width, height, GraphicsUnit.Pixel);       &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        img.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        bmp.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        graphics.Dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return bmp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    catch (Exception ex)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        MessageBox.Show(ex.Message);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;        return null;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;    }          &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;that's it....&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6831129116589455502?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6831129116589455502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6831129116589455502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6831129116589455502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6831129116589455502'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/cropping-image-with-best-quality-using.html' title='Cropping an Image with best quality using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8538535624526005164</id><published>2008-11-18T04:06:00.000-08:00</published><updated>2008-11-18T04:11:30.826-08:00</updated><title type='text'>Query for getting number of employee by department wise.</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Here I am having the following two tables.&lt;br /&gt;&lt;br /&gt;Table : &lt;span style="font-weight: bold;"&gt;Department&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;Id&lt;span style=""&gt;    &lt;/span&gt;Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;---&lt;span style=""&gt;   &lt;/span&gt;----&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;1&lt;span style=""&gt;        &lt;/span&gt;IT&lt;/p&gt;  &lt;p class="MsoNormal"&gt;2&lt;span style=""&gt;        &lt;/span&gt;Maths&lt;/p&gt;  &lt;p class="MsoNormal"&gt;3&lt;span style=""&gt;        &lt;/span&gt;Science&lt;/p&gt;&lt;br /&gt;Table: &lt;span style="font-weight: bold;"&gt;Employee&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;Id&lt;span style=""&gt;    &lt;/span&gt;Name&lt;span style=""&gt;  &lt;/span&gt;DeptId&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;---&lt;span style=""&gt;   &lt;/span&gt;----&lt;span style=""&gt;  &lt;/span&gt;------&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;1&lt;span style=""&gt;        &lt;/span&gt;aaa&lt;span style=""&gt;     &lt;/span&gt;2&lt;/p&gt;  &lt;p class="MsoNormal"&gt;2&lt;span style=""&gt;        &lt;/span&gt;vvv&lt;span style=""&gt;     &lt;/span&gt;2&lt;/p&gt;  &lt;p class="MsoNormal"&gt;3&lt;span style=""&gt;        &lt;/span&gt;eee&lt;span style=""&gt;     &lt;/span&gt;2&lt;/p&gt;  &lt;p class="MsoNormal"&gt;4&lt;span style=""&gt;        &lt;/span&gt;www&lt;span style=""&gt;   &lt;/span&gt;1&lt;/p&gt;  &lt;p class="MsoNormal"&gt;5&lt;span style=""&gt;        &lt;/span&gt;yyy&lt;span style=""&gt;     &lt;/span&gt;2&lt;/p&gt;  &lt;p class="MsoNormal"&gt;6&lt;span style=""&gt;        &lt;/span&gt;ppp&lt;span style=""&gt;     &lt;/span&gt;3&lt;/p&gt;  &lt;p class="MsoNormal"&gt;7&lt;span style=""&gt;        &lt;/span&gt;ooo&lt;span style=""&gt;     &lt;/span&gt;1&lt;/p&gt;  &lt;p class="MsoNormal"&gt;8&lt;span style=""&gt;        &lt;/span&gt;rrr&lt;span style=""&gt;       &lt;/span&gt;3&lt;/p&gt;  &lt;p class="MsoNormal"&gt;9&lt;span style=""&gt;        &lt;/span&gt;uuu&lt;span style=""&gt;     &lt;/span&gt;1&lt;/p&gt;  &lt;p class="MsoNormal"&gt;10&lt;span style=""&gt;      &lt;/span&gt;iii&lt;span style=""&gt;        &lt;/span&gt;3&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Now, I need to get the number of employee in each department. How to do?&lt;br /&gt;&lt;br /&gt;Here is the query for that.&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="color: rgb(255, 255, 204);"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;select&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; dept.Name as DepartmentName,count(*) as NoOfEmp from Department dept&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;INNER&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; JOIN Employee emp on emp.DeptId=dept.Id group by dept.Name&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;By running this query, we can get the values like as follows.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;DepartmentName&lt;span style=""&gt;    &lt;/span&gt;NoOfEmp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;--------------&lt;span style=""&gt;    &lt;/span&gt;-------&lt;span style="color:blue;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;IT&lt;span style=""&gt;                          &lt;/span&gt;3&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Maths&lt;span style=""&gt;                     &lt;/span&gt;4&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Science&lt;span style=""&gt;                  &lt;/span&gt;3&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;That's it...&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8538535624526005164?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8538535624526005164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8538535624526005164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8538535624526005164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8538535624526005164'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/query-for-getting-number-of-employee-by.html' title='Query for getting number of employee by department wise.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5260489786651498440</id><published>2008-11-13T05:33:00.000-08:00</published><updated>2008-11-13T05:36:04.271-08:00</updated><title type='text'>Getting the GridViewRow from checkbox checked event.</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Get the GridView Row when a checkbox clicked from a GridView.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Here I’m going to give a sample code for getting the selected GridView Row from a Gridview when a checkbox clicked from that gridview.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;protected void chkSelect_CheckedChanged(object sender, EventArgs e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style=""&gt;            &lt;/span&gt;CheckBox selectChkBox = (CheckBox)sender;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style=""&gt;          &lt;/span&gt;GridViewRow row = (GridViewRow)( selectChkBox.Parent.Parent);&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style=""&gt;            &lt;/span&gt;int index = row.RowIndex;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p style="color: rgb(255, 255, 204);" class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1.PRI%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:Verdana; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Here the “index” is the row of GridView.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;b style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5260489786651498440?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5260489786651498440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5260489786651498440' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5260489786651498440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5260489786651498440'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/11/getting-gridviewrow-from-checkbox.html' title='Getting the GridViewRow from checkbox checked event.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2429657198850362739</id><published>2008-10-30T04:21:00.001-07:00</published><updated>2008-10-30T04:23:04.147-07:00</updated><title type='text'>What is the difference between a == b and a.equals(b) ?</title><content type='html'>a == b means comparision between two variables.&lt;br /&gt;&lt;br /&gt;a.equals(b) means comparision between two objects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2429657198850362739?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2429657198850362739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2429657198850362739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2429657198850362739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2429657198850362739'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/10/what-is-difference-between-b-and.html' title='What is the difference between a == b and a.equals(b) ?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2105740766488385149</id><published>2008-10-30T04:07:00.000-07:00</published><updated>2008-10-30T04:14:34.850-07:00</updated><title type='text'>What is the difference between Int.parse and Convert.ToInt32</title><content type='html'>Both the &lt;strong&gt;int.Parse&lt;/strong&gt; and &lt;strong&gt;Convert.ToInt32&lt;/strong&gt; will return the same result. But the null handling only difference between them.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;string str = "15";&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;int Val1= Convert.ToInt32(str);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;int Val2= int.Parse(str);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From the above code, both Val1 and Val2 return the value as 15.  Suppose the string value str has null value,  &lt;strong&gt;Convert.ToInt32&lt;/strong&gt; will return zero and &lt;strong&gt;int.Parse&lt;/strong&gt; will throw &lt;strong&gt;ArgumentNullException&lt;/strong&gt; error.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;string str=null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;int Val1= Convert.ToInt32(str);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;int Val2 = int.Parse(str); //This will throw ArgumentNullException Error&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2105740766488385149?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2105740766488385149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2105740766488385149' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2105740766488385149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2105740766488385149'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/10/what-is-difference-between-intparse-and.html' title='What is the difference between Int.parse and Convert.ToInt32'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6734662652517718232</id><published>2008-10-13T05:30:00.000-07:00</published><updated>2008-10-13T05:32:10.603-07:00</updated><title type='text'>Get xml from a URL</title><content type='html'>&lt;strong&gt;Get xml from a URL&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Hi all,&lt;br /&gt; Using HTTPWebRequest and Response, we can easily get the xml file. FYI, see the below code.&lt;br /&gt;&lt;br /&gt;First of all, we need to add the following namespaces in our application.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.Xml;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Net;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Just copy the following code in your button_click event (or as your wish whichever event).&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;string url = "your url";&lt;br /&gt;Uri fileUrl = new Uri(url);&lt;br /&gt;HttpWebRequest request = (HttpWebRequest)WebRequest.Create(fileUrl);&lt;br /&gt;HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;Stream receiveStream = response.GetResponseStream();&lt;br /&gt;Encoding encode = System.Text.Encoding.GetEncoding("utf-8");&lt;br /&gt;StreamReader reader = new StreamReader(receiveStream, encode);&lt;br /&gt;string strValue = reader.ReadToEnd();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now the whole xml file in strValue variable.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6734662652517718232?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6734662652517718232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6734662652517718232' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6734662652517718232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6734662652517718232'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/10/get-xml-from-url.html' title='Get xml from a URL'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6357864862286129094</id><published>2008-09-09T23:05:00.000-07:00</published><updated>2008-09-09T23:07:13.408-07:00</updated><title type='text'>Swapping values between two variables without using temp variable.</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;There is an easy way to swapping values of two variables by using a temporary variable. But here am trying to get interchanged values between those variables without using any temporary variable. Just look in to this…&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;        public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; a = 10;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; b = 20;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;//Before swapping&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;textBox1.Text = a.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;textBox2.Text = b.ToString();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: green;"&gt;//After swapping&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;a = a + b;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;b = a - b;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;a = a - b;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;textBox1.Text = a.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;textBox2.Text = b.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;This has been coded in a windows application using C#.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana; color: maroon;"&gt;…S.VinothkumaR.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6357864862286129094?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6357864862286129094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6357864862286129094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6357864862286129094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6357864862286129094'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/09/swapping-values-between-two-variables.html' title='Swapping values between two variables without using temp variable.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4555979467195817718</id><published>2008-08-29T03:52:00.000-07:00</published><updated>2008-08-29T04:06:27.159-07:00</updated><title type='text'>How to combine two data tables?</title><content type='html'>I just am getting a situation to combine two data tables. Actually in my end, I had two datasets with two data tables in each of them. I needed to combine first data table in first dataset with first data table in second dataset. Similarly second data table in first dataset to second data table in second dataset.&lt;br /&gt;&lt;br /&gt;On that moment I just found the way to merge data tables by using &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;DataTable.Merge()&lt;/span&gt;&lt;/strong&gt; method.&lt;br /&gt;&lt;br /&gt;Then I combined my data tables as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;ds1.Tables[0].Merge(ds2.Tables[0], false,MissingSchemaAction.Add);&lt;br /&gt;ds1.Tables[1].Merge(ds2.Tables[1], false, MissingSchemaAction.Add);&lt;br /&gt;&lt;br /&gt;return ds1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;N.B:&lt;/strong&gt; Here ds1 is first dataset, ds2 is second dataset.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4555979467195817718?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4555979467195817718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4555979467195817718' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4555979467195817718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4555979467195817718'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/how-to-combine-two-data-tables.html' title='How to combine two data tables?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8781084690590411500</id><published>2008-08-29T02:44:00.000-07:00</published><updated>2008-08-29T02:48:18.165-07:00</updated><title type='text'>Selecting Top N Number of Rows - SQL Server 2005</title><content type='html'>&lt;p&gt;Hi all,&lt;br /&gt;&lt;br /&gt;We can get rows from a particular table by using the Select query as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;select * from [Table_Name]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we need 10 rows, we can use Top query like as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;select top 10 * from [Table_Name]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Suppose we need to pass the number of rows count as parameter…How to do?&lt;br /&gt;&lt;br /&gt;Yes, the way of using &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;ROW_NUMBER()&lt;/span&gt;&lt;/strong&gt;, we can do that. For more, see the following example,&lt;br /&gt;&lt;br /&gt;First we are going to create a table namely TestCount.&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;create table TestCount(SNo int, Name varchar(200))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Insert values in to that table.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;insert into TestCount(SNo,Name) values(1,'aaa')&lt;br /&gt;insert into TestCount(SNo,Name) values(2,'bbb')&lt;br /&gt;insert into TestCount(SNo,Name) values(3,'ccc')&lt;br /&gt;insert into TestCount(SNo,Name) values(4,'ddd')&lt;br /&gt;insert into TestCount(SNo,Name) values(5,'eee')&lt;br /&gt;insert into TestCount(SNo,Name) values(6,'fff')&lt;br /&gt;insert into TestCount(SNo,Name) values(7,'ggg')&lt;br /&gt;insert into TestCount(SNo,Name) values(8,'hhh')&lt;br /&gt;insert into TestCount(SNo,Name) values(9,'iii')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;insert into TestCount(SNo,Name) values(10,'jjj')&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Now use the following query to get top n number of rows.&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;declare @Count int&lt;br /&gt;set @Count = 5&lt;br /&gt;SELECT SNo,Name FROM&lt;br /&gt;(select ROW_NUMBER() over (order by [SNo])&lt;br /&gt;as Row, * FROM&lt;br /&gt;      (SELECT SNo,Name FROM TestCount)&lt;br /&gt;as userquery)&lt;br /&gt;as&lt;br /&gt;SelectionWithRowNumbers WHERE Row &gt;0 AND Row&lt;=@Count&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;That’s it. Hence we can get top n number of rows from a table.&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;…S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8781084690590411500?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8781084690590411500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8781084690590411500' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8781084690590411500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8781084690590411500'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/selecting-top-n-number-of-rows-sql.html' title='Selecting Top N Number of Rows - SQL Server 2005'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5184318628224967796</id><published>2008-08-28T01:19:00.000-07:00</published><updated>2008-08-28T01:24:45.407-07:00</updated><title type='text'>Creating an Excel application in Dot Net.</title><content type='html'>We can do the creation of excel application in Dot Net by using the interoperability services. The interoperability services make it easy to work with COM Capable Applications such as Word and Excel.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First of all we need to create a reference in our project to Excel object library by using add reference. You can get an “Add Reference” dialog box when clicking the add reference, choose com tab and select “Microsoft Excel 9.0 Object Library” as follows.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_MTawyT4n2e4/SLZf4CJjx_I/AAAAAAAAAqQ/UWL7rb75NiE/s1600-h/addref.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5239480632746428402" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_MTawyT4n2e4/SLZf4CJjx_I/AAAAAAAAAqQ/UWL7rb75NiE/s320/addref.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After adding this library we can get Interop.Excel.dll and Interop.Office.dll files in our bin folder. Using these dll files we can manipulate excel like excel file creation, opening and updating.&lt;br /&gt;&lt;br /&gt;When we ready to write code, first create an object of &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;Excel.Application&lt;/span&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;Excel._Workbook&lt;/span&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;Excel._Worksheet&lt;/span&gt;&lt;/strong&gt;. These are going to be used in creation of excel application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffff;"&gt;How to create excel application?&lt;/span&gt; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is the way to create an excel application. See the following code for help us to create an excel application.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;protected void btnCreateExcel_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            file = @"C:\temp\test.xls";&lt;br /&gt;            ex = new Excel.Application();&lt;br /&gt;            Excel._Workbook wb;&lt;br /&gt;            Excel._Worksheet ws;&lt;br /&gt;            wb = (Excel._Workbook)(ex.Workbooks.Add(Missing.Value));&lt;br /&gt;            ws = (Excel._Worksheet)(wb.Sheets["Sheet1"]);&lt;br /&gt;            ws.Name = "MyFirstSheet";&lt;br /&gt;            ws.Cells[1, 1] = "Test1";&lt;br /&gt;            ws.Cells[1, 2] = "Test2";&lt;br /&gt;            ws.Cells[2, 1] = "Test3";&lt;br /&gt;            ws.Cells[2, 2] = "Test4";&lt;br /&gt;            ws.Cells[3, 1] = "Test5";&lt;br /&gt;            ws.Cells[3, 2] = "Test6";&lt;br /&gt;            ws.get_Range("A1", "A3").Font.Bold = true;&lt;br /&gt;            ws.get_Range("A1", "C3").EntireColumn.AutoFit();&lt;br /&gt;            //wb.SaveAs(file, Excel.XlFileFormat.xlCSV, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing);&lt;br /&gt;            wb.SaveCopyAs(file);&lt;br /&gt;            wb.Close(null, null, null);&lt;br /&gt;            ex.Workbooks.Close();&lt;br /&gt;            ex.Quit();&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(ex);&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            Response.Write("Error: \n" + ex.ToString());&lt;br /&gt;        }&lt;br /&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By using the above code, now we have created an excel application &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;test.xls&lt;/span&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffff;"&gt;How to open an excel application and how can update with that application?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;Workbooks.Open&lt;/span&gt;&lt;/strong&gt; method is used to open an excel application. Then we can assign the values of some particular cells and will save that application by using the &lt;strong&gt;&lt;span style="color:#ffffff;"&gt;save&lt;/span&gt;&lt;/strong&gt; method. For more, see the following code.&lt;br /&gt;&lt;br /&gt; &lt;span style="color:#ffffcc;"&gt;protected void btnChangeExcel_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            file = @"C:\temp\test.xls";&lt;br /&gt;            ex = new Excel.ApplicationClass();&lt;br /&gt;            Excel._Workbook wbObj = null;&lt;br /&gt;            Excel._Worksheet wsObj = null;&lt;br /&gt;            Excel.Range rngObj = null;&lt;br /&gt;            wbObj = ex.Workbooks.Open(file, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true);&lt;br /&gt;            wsObj = (Excel._Worksheet)wbObj.Worksheets[1];&lt;br /&gt;            wsObj.Cells[1, 1] = "1";&lt;br /&gt;            wsObj.Cells[1, 2] = "2";&lt;br /&gt;            wsObj.Cells[1, 3] = "3";&lt;br /&gt;            wsObj.Cells[2, 1] = "A";&lt;br /&gt;            wsObj.Cells[2, 2] = "B";&lt;br /&gt;            wsObj.Cells[2, 3] = "C";&lt;br /&gt;            rngObj = wsObj.get_Range("A1", "C2");&lt;br /&gt;            rngObj.EntireRow.AutoFit();&lt;br /&gt;            rngObj.EntireColumn.AutoFit();&lt;br /&gt;            wbObj.Save();&lt;br /&gt;            wbObj.Close(null, null, null);&lt;br /&gt;            ex.Workbooks.Close();&lt;br /&gt;            ex.Quit();&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(rngObj);&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(wsObj);&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(wbObj);&lt;br /&gt;            System.Runtime.InteropServices.Marshal.ReleaseComObject(ex);&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            Response.Write("Error: \n" + ex.ToString());&lt;br /&gt;        }&lt;br /&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That’s it. Hence we have created an excel application and updating some particular cells in that application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5184318628224967796?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5184318628224967796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5184318628224967796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5184318628224967796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5184318628224967796'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/creating-excel-application-in-dot-net.html' title='Creating an Excel application in Dot Net.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MTawyT4n2e4/SLZf4CJjx_I/AAAAAAAAAqQ/UWL7rb75NiE/s72-c/addref.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3246624062244277251</id><published>2008-08-04T04:21:00.000-07:00</published><updated>2008-08-04T04:32:55.865-07:00</updated><title type='text'>How to find the queries which are use the most CPU time and most IO?</title><content type='html'>Most of us wanted to know which queries are use the most &lt;strong&gt;CPU time&lt;/strong&gt; and&lt;strong&gt; most IO&lt;/strong&gt; in a db server.&lt;br /&gt;&lt;br /&gt;We can get that information using the dynamic management view, such as &lt;strong&gt;dm_exec_query_stats&lt;/strong&gt; and&lt;strong&gt; dm_exec_sql_text.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;For this, first of all we need to create the following procedure.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;USE [master]&lt;br /&gt;GO&lt;br /&gt;IF EXISTS (SELECT * FROM sys.objects WHERE object_id =&lt;br /&gt;OBJECT_ID(N'[dbo].[dba_TOP_Queries_Average]')&lt;br /&gt;AND type in (N'P', N'PC'))&lt;br /&gt;DROP PROCEDURE [dbo].[dba_TOP_Queries_Average]&lt;br /&gt;go&lt;br /&gt;CREATE procedure dba_TOP_Queries_Average @topcount int=10,&lt;br /&gt;@type varchar(10) ='cpu'&lt;br /&gt;as&lt;br /&gt;begin try&lt;br /&gt;select Top (@topcount )&lt;br /&gt;creation_time&lt;br /&gt;, last_execution_time&lt;br /&gt;,rank() over(order by (total_worker_time+0.0)/&lt;br /&gt;execution_count desc,&lt;br /&gt;sql_handle,statement_start_offset ) as row_no&lt;br /&gt;, (rank() over(order by (total_worker_time+0.0)/&lt;br /&gt;execution_count desc,&lt;br /&gt;sql_handle,statement_start_offset ))%2 as l1&lt;br /&gt;, (total_worker_time+0.0)/1000 as total_worker_time&lt;br /&gt;, (total_worker_time+0.0)/(execution_count*1000)&lt;br /&gt;as [AvgCPUTime]&lt;br /&gt;, total_logical_reads as [LogicalReads]&lt;br /&gt;, total_logical_writes as [LogicalWrites]&lt;br /&gt;, execution_count&lt;br /&gt;, total_logical_reads+total_logical_writes as [AggIO]&lt;br /&gt;, (total_logical_reads+total_logical_writes)/&lt;br /&gt;(execution_count+0.0) as [AvgIO]&lt;br /&gt;, case when sql_handle IS NULL&lt;br /&gt;then ' '&lt;br /&gt;else ( substring(st.text,(qs.statement_start_offset+2)/2,&lt;br /&gt;(case when qs.statement_end_offset = -1&lt;br /&gt;then len(convert(nvarchar(MAX),st.text))*2&lt;br /&gt;else qs.statement_end_offset&lt;br /&gt;end - qs.statement_start_offset) /2 ) )&lt;br /&gt;end as query_text&lt;br /&gt;, db_name(st.dbid) as db_name&lt;br /&gt;, st.objectid as object_id&lt;br /&gt;from sys.dm_exec_query_stats qs&lt;br /&gt;cross apply sys.dm_exec_sql_text(sql_handle) st&lt;br /&gt;where total_worker_time &gt; 0&lt;br /&gt;order by case when @type='cpu' then (total_worker_time+0.0)/(execution_count*1000)&lt;br /&gt;else (total_logical_reads+total_logical_writes)/(execution_count+0.0) end desc&lt;br /&gt;end try&lt;br /&gt;begin catch&lt;br /&gt;select -100 as row_no&lt;br /&gt;, 1 as l1, 1 as create_time,1 as last_execution_time,1 as total_worker_time,1 as AvgCPUTime,1 as LogicalReads,1&lt;br /&gt;as LogicalWrites&lt;br /&gt;, ERROR_NUMBER() as execution_count&lt;br /&gt;, ERROR_SEVERITY() as AggIO&lt;br /&gt;, ERROR_STATE() as AvgIO&lt;br /&gt;, ERROR_MESSAGE() as query_text&lt;br /&gt;, 0 as db_name&lt;br /&gt;, 0 as object_name&lt;br /&gt;end catch&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we can get the top 10 queries based on the CPU usage. By default our procedure will return top 10 queries. Because we given the topcount as 10.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;exec [dbo].[dba_TOP_Queries_Average]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If we need to get top 10 queries based on the average I/O usage, do as following.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;exec [dbo].[dba_TOP_Queries_Average] @type = 'Avg'&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If we need to get top n queries,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;strong&gt;exec [dbo].[dba_TOP_Queries_Average] @topcount =14, @type = 'Avg'&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;strong&gt;exec [dbo].[dba_TOP_Queries_Average] @topcount =14, @type = 'cpu'&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That’s it…&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3246624062244277251?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3246624062244277251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3246624062244277251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3246624062244277251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3246624062244277251'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/how-to-find-queries-which-are-use-most.html' title='How to find the queries which are use the most CPU time and most IO?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1789041381339654116</id><published>2008-08-01T23:04:00.000-07:00</published><updated>2008-08-01T23:19:53.712-07:00</updated><title type='text'>GROUP BY, HAVING, SUM, AVG, and COUNT(*)</title><content type='html'>Here is the simple example of using the clauses like &lt;strong&gt;where&lt;/strong&gt;, &lt;strong&gt;Having&lt;/strong&gt;, &lt;strong&gt;Group&lt;/strong&gt; &lt;strong&gt;By&lt;/strong&gt; and the aggregations like &lt;strong&gt;Count&lt;/strong&gt;, &lt;strong&gt;Sum&lt;/strong&gt; and &lt;strong&gt;Avg&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;First we will have a simple and a small table ‘order’ with data’s as follows,&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;ORDER STATE AMOUNT &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;------+-------+------------- &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1234 NY 10.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1235 TX 15.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1236 CA 20.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1237 TX 25.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1238 CA 30.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1237 NY 35.00 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;1238 NY 40.00&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Aggregation:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Aggregation combines rows together and performs some operation on their combined values. Very common aggregations are &lt;strong&gt;COUNT&lt;/strong&gt;, &lt;strong&gt;SUM&lt;/strong&gt;, and &lt;strong&gt;AVG&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;SELECT COUNT(*) as count,SUM(amount) as sum,AVG(amount) as avg FROM orders&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;this query will return as,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;count sum avg&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-----+------+----- &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;7 175 25&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Where Clause:&lt;/strong&gt;&lt;br /&gt;If we need to get result with the basis of any state, use the following query.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;SELECT COUNT(*) as count,SUM(amount) as sum,AVG(amount) as avg FROM orders WHERE state = 'NY'&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;this will return as,&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;count sum avg&lt;br /&gt;----+------+----------&lt;br /&gt;3        85          28.33333&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As from the above results, there is the average has a repeating decimal. So we can use the &lt;strong&gt;Round&lt;/strong&gt; function.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Group By Clause:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The &lt;strong&gt;GROUP BY&lt;/strong&gt; clause says that the aggregations should be performed for the distinct values of a column or columns.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;SELECT state, COUNT(*) as count,SUM(amount) as sum, ROUND(AVG(amount),0) as avg FROM orders GROUP BY state&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This will return as,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;STATE  count  sum   avg&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;------+-----+------+----&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;NY      3    85    28&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;TX      2    40    20                           &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;CA      2    50    25&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Having Clause:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The &lt;strong&gt;HAVING&lt;/strong&gt; clause lets us put a filter on the results after the aggregation has taken place. If we need to know which state having average amount of Rs.25 or more, use the following code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;SELECT state, COUNT(*) as count,SUM(amount) as sum, ROUND(AVG(amount),0) as avg FROM orders GROUP BY state HAVING AVG(amount) &gt;= 25&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Result of this query,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;state  count  sum   avg&lt;br /&gt;------+-----+------+----&lt;br /&gt;NY      3    85    28&lt;br /&gt;CA      2    50    25&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we can pull results out of a database in a single query with the use of combine the &lt;strong&gt;WHERE&lt;/strong&gt;, &lt;strong&gt;GROUP BY&lt;/strong&gt;, and &lt;strong&gt;HAVING&lt;/strong&gt; as follows,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;SELECT state, COUNT(*),SUM(amount) as sum, ROUND(AVG(amount),0) as avg FROM orders WHERE amount &gt; 20 GROUP BY state HAVING avg(amount) &gt;= 30&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;That's it....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1789041381339654116?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1789041381339654116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1789041381339654116' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1789041381339654116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1789041381339654116'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/group-by-having-sum-avg-and-count.html' title='GROUP BY, HAVING, SUM, AVG, and COUNT(*)'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6686422381815922440</id><published>2008-08-01T07:02:00.000-07:00</published><updated>2008-08-01T07:06:19.835-07:00</updated><title type='text'>Creating chart with Crystal Report application.</title><content type='html'>Crystal Report also supports the creation of charts. Now we are going to see how we can display a chart showing the percentages of a particular product ordered by the each customer. &lt;br /&gt;Add new crystal report in our solution and do as the following steps.&lt;br /&gt;&lt;br /&gt;1. Add the following tables to the report&lt;br /&gt;      Customers&lt;br /&gt;     Order Details&lt;br /&gt;     Orders&lt;br /&gt;    Products&lt;br /&gt; 2. Choose the following fields to display: &lt;br /&gt;     Customers.CompanyName&lt;br /&gt;     Products.ProductName&lt;br /&gt;     Order Details.Quantity   &lt;br /&gt;3. Group the report by Customers.CompanyName.&lt;br /&gt;4. For the Summaries section, ensure that only Sum of Order Details.Quantity is present.&lt;br /&gt;5. In the Chart dialog, check the Pie Chart option.&lt;br /&gt;&lt;br /&gt;Now, add a new Parameter Field to the report and name the parameter Product_Name. Click the Select Expert button and bind the parameter to the Products.ProductName field of the report.&lt;br /&gt;&lt;br /&gt;Finally, add the following controls to Form1:&lt;br /&gt; - Label&lt;br /&gt; - ComboBox&lt;br /&gt; - Button&lt;br /&gt;Write the code as following to view chart,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            string connStr = "Data Source=.\\SQLEXPRESS;Initial Catalog=myDB;Integrated Security=True"; &lt;br /&gt;            string sql = "SELECT CustomerID FROM Customers"; &lt;br /&gt;            SqlConnection conn = new SqlConnection(connStr); &lt;br /&gt;            SqlCommand comm = new SqlCommand(sql, conn); &lt;br /&gt;            conn.Open(); &lt;br /&gt;            SqlDataReader reader = comm.ExecuteReader; &lt;br /&gt;            while (reader.Read)&lt;br /&gt;            {&lt;br /&gt;                comboBox1.Items.Add(reader(0));&lt;br /&gt;            }&lt;br /&gt;            conn.Close();&lt;br /&gt;            sql = "SELECT ProductName from Products";&lt;br /&gt;            comm.CommandText = sql;&lt;br /&gt;            conn.Open();&lt;br /&gt;            reader = comm.ExecuteReader;&lt;br /&gt;            while (reader.Read)&lt;br /&gt;            {&lt;br /&gt;                ComboBox2.Items.Add(reader(0));&lt;br /&gt;            }&lt;br /&gt;            conn.Close();&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In button click event,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void btnViewReport_Click(object sender, System.EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            CrystalReport2 report = new CrystalReport2();&lt;br /&gt;            report.SetParameterValue("Product_Name", ComboBox2.Text);&lt;br /&gt;            {&lt;br /&gt;                Form2.CrystalReportViewer1.ReportSource = report;&lt;br /&gt;                Form2.ShowDialog();&lt;br /&gt;            }&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That’s it… Now you can test with running the application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6686422381815922440?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6686422381815922440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6686422381815922440' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6686422381815922440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6686422381815922440'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/creating-chart-with-crystal-report.html' title='Creating chart with Crystal Report application.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6459070154465842417</id><published>2008-08-01T06:51:00.000-07:00</published><updated>2008-08-01T07:01:58.646-07:00</updated><title type='text'>Adding parameters to the Crystal Report:</title><content type='html'>We can pass parameters to report during runtime. For that you need to follow the steps as below…&lt;br /&gt;Main Report view -- &gt; right click on the parameter fields items located in the field explorer&lt;br /&gt;-- &gt; select new -- &gt; specify Customer_ID as the name -- &gt; click ok -- &gt; In the choose field dialog, choose CustomerId and click ok.&lt;br /&gt;&lt;br /&gt;Now click the Select Expert button which is in the toolbar of Visual Studio 2005. In the Select Expert dialog, set the value of the control as CustomerId &lt;strong&gt;is equal to&lt;/strong&gt; Customer_ID.&lt;br /&gt;&lt;br /&gt;Now create a wizard in form1 using follows,&lt;br /&gt; - Label (CustomerID )&lt;br /&gt; - Combo Box (comboBox1)&lt;br /&gt; - Button(ViewReports)&lt;br /&gt;&lt;br /&gt;Write code in form1 code behind as follows to add parameters to report.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.Data;&lt;br /&gt;using System.Data.SqlClient;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            string connStr = "Data Source=.\\SQLEXPRESS;Initial Catalog=myDB;Integrated Security=True"; &lt;br /&gt;            string sql = "SELECT CustomerID FROM Customers"; &lt;br /&gt;            SqlConnection conn = new SqlConnection(connStr); &lt;br /&gt;            SqlCommand comm = new SqlCommand(sql, conn);&lt;br /&gt;            conn.Open(); &lt;br /&gt;            SqlDataReader reader = comm.ExecuteReader; &lt;br /&gt;            while (reader.Read)&lt;br /&gt;            {&lt;br /&gt;                comboBox1.Items.Add(reader(0));&lt;br /&gt;            }&lt;br /&gt;            conn.Close();&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now switch to button click event,&lt;br /&gt; &lt;span style="color:#ffffcc;"&gt;private void btnViewReport_Click(object sender, System.EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            CrystalReport1 report = new CrystalReport1();&lt;br /&gt;            report.SetParameterValue("Customer_ID", ComboBox1.Text);&lt;br /&gt;            {&lt;br /&gt;                Form2.CrystalReportViewer1.ReportSource = report;&lt;br /&gt;                Form2.ShowDialog();&lt;br /&gt;            }&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That’s it. Now you can test the application by running.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;...S.VinothkumaR.&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6459070154465842417?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6459070154465842417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6459070154465842417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6459070154465842417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6459070154465842417'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/08/adding-parameters-to-crystal-report.html' title='Adding parameters to the Crystal Report:'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6745141056454802462</id><published>2008-07-28T06:50:00.000-07:00</published><updated>2008-07-28T06:55:26.637-07:00</updated><title type='text'>Crystal Report using in DotNet</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;I am going to explain how to create a report by using Crystal Report in DotNet here.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;Generating Report:&lt;br /&gt;----------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To create a report using crystal report, just follow the steps mentioned below which is very useful to using crystal repot.&lt;br /&gt;&lt;br /&gt;In Visual Studio 2005, create new project with a name as your wish. Add a new item to the project by right clicking on the project name in solution explorer. Select the crystal report template with a name as your wish.&lt;br /&gt;&lt;br /&gt;Now you are in Crystal Report Gallery dialog. Now you should choose the “Using the Report Wizard” and “Standard” options and click OK.&lt;br /&gt;&lt;br /&gt;The Standard Report Creation Wizard dialog will appear. Now you should choose the data source to connect SQL Server 2005. For that just expand the Create New Connection data source and expand the OLEDB(ADO) item. Then select an OLEDB provider “SQL Native Client” for SQL Server 2005 databases.&lt;br /&gt;&lt;br /&gt;Now we need to provide the connection information for the database. Type the server name and check the Integrity Security checkbox. Then click the dropdown list next to the database item and select the database. Click the next to continue, in next dialog finish to configuring the data source.&lt;br /&gt;&lt;br /&gt;Now you need to choose the tables to use for the report. Expand your database and select the tables by using &gt; button.&lt;br /&gt;&lt;br /&gt;Click the next to continue. Here you need to confirm the relationships between the various tables you have selected. Then click the next to continue.&lt;br /&gt;&lt;br /&gt;Now you should choose the fields to use for the report by using &gt; button. Then click next, in the next dialog you should choose the field to group the report.&lt;br /&gt;&lt;br /&gt;Clicks next to continue there will three dialogs seemed. Just give next and next, in final dialog you can select report style finally click finish then your report will be ready.&lt;br /&gt;Previewing Report:&lt;br /&gt;---------------------&lt;br /&gt;&lt;br /&gt;After creating the report, you can preview that by clicking the Main Report Preview button which is in the bottom of report.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;strong&gt;Vie&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;wing&lt;/span&gt;&lt;span style="color:#ffffcc;"&gt; your Report in Windows Form:&lt;br /&gt;--------------------------------------------&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you want to see the report in windows form, you will need to use the CrystalReportViewer control.&lt;br /&gt;&lt;br /&gt;First you will need to add a new windows form to the project. And add the CrystalReportViewer control in to your form. Now add a button control in to form and named it as “ViewReport”.&lt;br /&gt;&lt;br /&gt;Then write code as below in the button clicked event.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://labs.developerfusion.co.uk/SourceViewer/search/SSCLI/CrystalReport1/"&gt;&lt;span style="color:#ffffcc;"&gt;CrystalReport1&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#ffffcc;"&gt; report = new &lt;/span&gt;&lt;a href="http://labs.developerfusion.co.uk/SourceViewer/search/SSCLI/CrystalReport1/"&gt;&lt;span style="color:#ffffcc;"&gt;CrystalReport1&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#ffffcc;"&gt;();&lt;br /&gt;    {&lt;br /&gt;        Form2.CrystalReportViewer1.ReportSource = report;&lt;br /&gt;        Form2.ShowDialog();&lt;br /&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6745141056454802462?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6745141056454802462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6745141056454802462' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6745141056454802462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6745141056454802462'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/07/crystal-report-using-in-dotnet.html' title='Crystal Report using in DotNet'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7349183296966841562</id><published>2008-07-03T06:00:00.001-07:00</published><updated>2008-07-03T06:05:09.406-07:00</updated><title type='text'>Diamond inheritance / Ambiguities in inheritance</title><content type='html'>Hi friends,&lt;br /&gt;Here I am explained the Diamond Inheritance and Ambiguities in inheritance. Just watch out the below image and with my explonation.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_MTawyT4n2e4/SGzNtKlTSUI/AAAAAAAAAqI/JQGi0Tp5ojk/s1600-h/Diamond+inheritance.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218772244034177346" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_MTawyT4n2e4/SGzNtKlTSUI/AAAAAAAAAqI/JQGi0Tp5ojk/s320/Diamond+inheritance.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;      The above figure illustrates the diamond inheritance. The class &lt;strong&gt;IOS&lt;/strong&gt; is the base class for both &lt;strong&gt;IStream &lt;/strong&gt;and &lt;strong&gt;OStream &lt;/strong&gt;classes. Each of those classes formed with &lt;strong&gt;single inheritance&lt;/strong&gt;. The class &lt;strong&gt;IOStream&lt;/strong&gt; inherits from both &lt;strong&gt;IStream &lt;/strong&gt;and &lt;strong&gt;OStream &lt;/strong&gt;classes. This class object will provide the functionality of both &lt;strong&gt;IOStream&lt;/strong&gt; and &lt;strong&gt;OStream&lt;/strong&gt; classes. In &lt;strong&gt;multiple inheritance &lt;/strong&gt;hierarchies, the situation described in above figure is referred to as &lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;Diamond Inheritance&lt;/span&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;         There would be seemed a problem in &lt;strong&gt;IOStream &lt;/strong&gt;class. Because the class &lt;strong&gt;IOStream &lt;/strong&gt;contain two copies of the members of class &lt;strong&gt;IOS&lt;/strong&gt;. One inherited via the class &lt;strong&gt;IStream &lt;/strong&gt;and another one inherited via the class &lt;strong&gt;OStream&lt;/strong&gt;. Such a situation would be &lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;ambiguous &lt;/span&gt;&lt;/strong&gt;and would result in a compilation error. Because the compiler wouldn’t know which version of members from class &lt;strong&gt;IOS &lt;/strong&gt;to use.&lt;br /&gt;&lt;br /&gt;In this situation, the &lt;strong&gt;virtual &lt;/strong&gt;base class solves the problem of inheriting duplicate copies of an indirect base class.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7349183296966841562?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7349183296966841562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7349183296966841562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7349183296966841562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7349183296966841562'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/07/diamond-inheritance-ambiguities-in.html' title='Diamond inheritance / Ambiguities in inheritance'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MTawyT4n2e4/SGzNtKlTSUI/AAAAAAAAAqI/JQGi0Tp5ojk/s72-c/Diamond+inheritance.GIF' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4910700704750767206</id><published>2008-07-03T01:46:00.000-07:00</published><updated>2008-07-03T01:51:08.577-07:00</updated><title type='text'>Converting xml to string in C#</title><content type='html'>Hi friends,&lt;br /&gt;Here is the simple code for converting xml to string.&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;string strXML = "";&lt;br /&gt;StringReader reader = new StringReader("C:\\test.xml");&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;doc.Load(reader);&lt;br /&gt;if (doc != null)&lt;br /&gt;{&lt;br /&gt;StringWriter writer = new StringWriter();&lt;br /&gt;doc.Save(writer);&lt;br /&gt;strXML = writer.ToString();&lt;br /&gt;}&lt;br /&gt;doc = null;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4910700704750767206?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4910700704750767206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4910700704750767206' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4910700704750767206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4910700704750767206'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/07/converting-xml-to-string-in-c.html' title='Converting xml to string in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1456687381164338421</id><published>2008-07-02T05:46:00.000-07:00</published><updated>2008-07-02T05:59:35.656-07:00</updated><title type='text'></title><content type='html'>Hi all,&lt;br /&gt;Here I have listed the JavascriptCode, Numerical code and Hex code for some symbols. Find out from the following images.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_MTawyT4n2e4/SGt41bHL1nI/AAAAAAAAAo4/5LpS9PEm1DY/s1600-h/1.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218397452445144690" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_MTawyT4n2e4/SGt41bHL1nI/AAAAAAAAAo4/5LpS9PEm1DY/s320/1.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_MTawyT4n2e4/SGt5axgJnWI/AAAAAAAAApA/HEycFbwzaO8/s1600-h/2.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218398094110596450" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_MTawyT4n2e4/SGt5axgJnWI/AAAAAAAAApA/HEycFbwzaO8/s320/2.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_MTawyT4n2e4/SGt5rpJqakI/AAAAAAAAApI/PSPwrdZOExc/s1600-h/3.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218398383926569538" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_MTawyT4n2e4/SGt5rpJqakI/AAAAAAAAApI/PSPwrdZOExc/s320/3.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_MTawyT4n2e4/SGt5y_OkkFI/AAAAAAAAApQ/myAIBtPV64M/s1600-h/4.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218398510111821906" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_MTawyT4n2e4/SGt5y_OkkFI/AAAAAAAAApQ/myAIBtPV64M/s320/4.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_MTawyT4n2e4/SGt6jDArmtI/AAAAAAAAApY/JL1Rg3u0Zf0/s1600-h/5.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218399335761025746" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_MTawyT4n2e4/SGt6jDArmtI/AAAAAAAAApY/JL1Rg3u0Zf0/s320/5.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_MTawyT4n2e4/SGt6t9HbCMI/AAAAAAAAApg/zSHhVeosw78/s1600-h/6.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218399523157248194" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_MTawyT4n2e4/SGt6t9HbCMI/AAAAAAAAApg/zSHhVeosw78/s320/6.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_MTawyT4n2e4/SGt7JzKXY_I/AAAAAAAAApo/QlVPKJM2yTM/s1600-h/7.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218400001521574898" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_MTawyT4n2e4/SGt7JzKXY_I/AAAAAAAAApo/QlVPKJM2yTM/s320/7.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_MTawyT4n2e4/SGt7J5HPZ-I/AAAAAAAAApw/fzVHHzlVM_k/s1600-h/8.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218400003119081442" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_MTawyT4n2e4/SGt7J5HPZ-I/AAAAAAAAApw/fzVHHzlVM_k/s320/8.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_MTawyT4n2e4/SGt7KKZ-h2I/AAAAAAAAAp4/7xKjzUhXNnI/s1600-h/9.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218400007761069922" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_MTawyT4n2e4/SGt7KKZ-h2I/AAAAAAAAAp4/7xKjzUhXNnI/s320/9.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://bp2.blogger.com/_MTawyT4n2e4/SGt7KZ6IooI/AAAAAAAAAqA/zTQpZeIzpKU/s1600-h/10.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218400011922481794" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_MTawyT4n2e4/SGt7KZ6IooI/AAAAAAAAAqA/zTQpZeIzpKU/s320/10.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1456687381164338421?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1456687381164338421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1456687381164338421' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1456687381164338421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1456687381164338421'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/07/hi-all-here-i-have-listed.html' title=''/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MTawyT4n2e4/SGt41bHL1nI/AAAAAAAAAo4/5LpS9PEm1DY/s72-c/1.GIF' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8887145538773312250</id><published>2008-07-01T06:28:00.000-07:00</published><updated>2008-07-01T06:33:03.805-07:00</updated><title type='text'>Difference between Stack and Heap</title><content type='html'>&lt;strong&gt;Stack:&lt;br /&gt;&lt;/strong&gt;- Variables of value type are allocated in stack.&lt;br /&gt;- Memory allocation of stack is speader than heap.&lt;br /&gt;- If the object is small we should use value type (stack).&lt;br /&gt;&lt;strong&gt;Heap:&lt;br /&gt;&lt;/strong&gt;- Variables of reference type are allocated in heap.&lt;br /&gt;- Memory allocation is slow.&lt;br /&gt;- If the object is big one, using reference type is fine (heap).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8887145538773312250?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8887145538773312250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8887145538773312250' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8887145538773312250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8887145538773312250'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/07/difference-between-stack-and-heap.html' title='Difference between Stack and Heap'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-955528987489824061</id><published>2008-06-30T03:28:00.000-07:00</published><updated>2008-06-30T03:29:43.791-07:00</updated><title type='text'>Difference between Session state and Application state</title><content type='html'>Session state and Application state both are support the same type of objects and maintain information on the server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session state:&lt;/strong&gt;&lt;br /&gt;-         The session object is used to maintain the session of each user. A user gets a session id when he enters in to an application. This Id will delete when he leave from that application. If he enters again he will get a different session Id.&lt;br /&gt;-         Session allows information to be stored in one page and access in another page and support any type of object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Application state:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-         But the application object, the Id is maintained for whole application.&lt;br /&gt;-         Application state allows storing global objects that can be accessed by any client.&lt;br /&gt;  &lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-955528987489824061?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/955528987489824061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=955528987489824061' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/955528987489824061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/955528987489824061'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/difference-between-session-state-and.html' title='Difference between Session state and Application state'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1396196592566370570</id><published>2008-06-30T02:42:00.000-07:00</published><updated>2008-06-30T02:44:44.624-07:00</updated><title type='text'>Difference between View State and Session State</title><content type='html'>&lt;p&gt;Session state and view state are used to keep on certain data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;View State:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-         View state is maintained in page level only.&lt;br /&gt;-         View state of one page is not visible in another page.&lt;br /&gt;-         View state information stored in client only.&lt;br /&gt;-         View state persist the values of particular page in the client (browser) when post back operation done.&lt;br /&gt;-         View state used to persist page-instance-specific data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session State:&lt;/strong&gt;&lt;br /&gt;-         Session state is maintained in session level.&lt;br /&gt;-         Session state value is available in all pages within a user session.&lt;br /&gt;-         Session state information stored in server.&lt;br /&gt;-         Session state persist the data of particular user in the server. This data available till user close the browser or session time completes.&lt;br /&gt;-         Session state used to persist the user-specific data on the server side.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1396196592566370570?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1396196592566370570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1396196592566370570' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1396196592566370570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1396196592566370570'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/difference-between-view-state-and.html' title='Difference between View State and Session State'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3008780935901888606</id><published>2008-06-26T04:33:00.000-07:00</published><updated>2008-06-26T04:38:00.286-07:00</updated><title type='text'>How to send Authenticated Emails?</title><content type='html'>Here is sample for sending Authenticated emails.&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void SendMail()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;MailMessage mail = new MailMessage();&lt;br /&gt;mail.From = new MailAddress("vinothnat@hotmail.com", "Vinothkumar");&lt;br /&gt;mail.To.Add(new MailAddress("vinoth_nat@hotmail.com", "S.Vinothkumar"));&lt;br /&gt;&lt;span style="color:#cccccc;"&gt;//To property is a generic collection. So we can add as many recipients as we like &lt;/span&gt;&lt;br /&gt;mail.Subject = "TestMail";&lt;br /&gt;mail.Body = "I am testing the mail with credentials.";&lt;br /&gt;mail.IsBodyHtml = true;&lt;br /&gt;SmtpClient smtp = new SmtpClient("localhost");&lt;br /&gt;smtp.DeliveryMethod = SmtpDeliveryMethod.Network;&lt;br /&gt;NetworkCredential credential = new NetworkCredential("username", "password");&lt;br /&gt;smtp.UseDefaultCredentials = false;&lt;br /&gt;smtp.Credentials = credential;&lt;br /&gt;smtp.Send(mail);&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;Response.Write(ex.ToString());&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3008780935901888606?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3008780935901888606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3008780935901888606' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3008780935901888606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3008780935901888606'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/how-to-send-authenticated-emails.html' title='How to send Authenticated Emails?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8060627792294718934</id><published>2008-06-20T23:11:00.000-07:00</published><updated>2008-06-20T23:20:00.748-07:00</updated><title type='text'>Sql Server Function to get number of working days in given days.</title><content type='html'>Here is an example to get the number of working days in given couple of days.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;CREATE FUNCTION dbo.GetWorkingDays  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;      @startDate SMALLDATETIME,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;      @endDate SMALLDATETIME &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;) &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;RETURNS INT  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;AS  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;BEGIN     &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DECLARE @WDays INT;      &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SET @WDays = DATEDIFF(DAY, @startDate, @endDate)+1;     &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;RETURN      &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;         SELECT @WDays / 7 * 5 + @WDays % 7 - &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;             (&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                 SELECT COUNT(*)  FROM  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                  (&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    SELECT 1 AS d &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT 2  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT 3 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT 4&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT 5&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT 6&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    UNION ALL SELECT &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                   ) weekdays              &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                    WHERE d &lt;= @WDays % 7 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                   AND DATENAME(WEEKDAY, @endDate - d + 1)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                   IN &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                   (&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                     'Saturday',&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                     'Sunday'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;                 )&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;             )&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;     ); &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;END  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;GO&lt;br /&gt;PRINT dbo.getWorkingDays('20080601', '20080630')&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8060627792294718934?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8060627792294718934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8060627792294718934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8060627792294718934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8060627792294718934'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/sql-server-function-to-get-number-of_20.html' title='Sql Server Function to get number of working days in given days.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6255037787633078928</id><published>2008-06-20T23:05:00.000-07:00</published><updated>2008-06-20T23:09:42.935-07:00</updated><title type='text'>SQL Server Function to get Number Of Days in a month.</title><content type='html'>Here is an example to getting number of days in a month.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;CREATE FUNCTION dbo.GetNumberOfDays&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;@inMonth DATETIME&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;RETURNS INT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;Declare @Days int&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;Set @Days=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;set @Days=CASE WHEN MONTH(@inMonth) IN (1,3,5,7,8,10,12) THEN 31&lt;br /&gt;  WHEN MONTH(@inMonth) IN (4,6,9,11) THEN 30 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;ELSE CASE WHEN (YEAR(@inMonth) % 4 = 0 AND YEAR(@inMonth) % 100!=0) OR (YEAR(@inMonth) % 400=0) THEN 29 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;ELSE 28 END&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;END&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;select @Days&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;END&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;PRINT dbo.GetNumberOfDays(getDate())&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6255037787633078928?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6255037787633078928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6255037787633078928' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6255037787633078928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6255037787633078928'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/sql-server-function-to-get-number-of.html' title='SQL Server Function to get Number Of Days in a month.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7938935620836176854</id><published>2008-06-20T05:02:00.000-07:00</published><updated>2008-06-20T05:06:55.341-07:00</updated><title type='text'>Easy way to find browsers in JavaScript</title><content type='html'>&lt;p&gt;Hi all,&lt;br /&gt; Here I have written a JavaScript function to get the browser.&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;function myBrowser() &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;{ &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;var browser=navigator.userAgent.toLowerCase(); &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("msie") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Internet Explorer'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("firefox") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Firefox'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("opera") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Opera'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("safari") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Safari'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("netscape") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Netscape'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("mozilla/5.0") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Mozilla'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("staroffice") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Star Office'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("webtv") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'WebTV'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("beonex") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Beonex'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("chimera") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Chimera'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("netpositive") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'NetPositive'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("phoenix") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'Phoenix'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;if (browser.indexOf("skipstone") != -1) &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;return 'SkipStone'; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7938935620836176854?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7938935620836176854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7938935620836176854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7938935620836176854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7938935620836176854'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/easy-way-to-find-browsers-in-javascript.html' title='Easy way to find browsers in JavaScript'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-7164085083783319686</id><published>2008-06-13T02:37:00.000-07:00</published><updated>2008-06-13T02:41:03.919-07:00</updated><title type='text'>Alternate to location.href</title><content type='html'>Hi all,&lt;br /&gt;Actually the &lt;strong&gt;location.href&lt;/strong&gt; functionality is some times not working in firefox . So we can use the following way is the alternative for "&lt;strong&gt;location.href&lt;/strong&gt;."&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ffffcc;"&gt;top.window.opener.location.href&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;...S.VinothkumaR.&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-7164085083783319686?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/7164085083783319686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=7164085083783319686' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7164085083783319686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/7164085083783319686'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/06/alternate-to-locationhref.html' title='Alternate to location.href'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3203947156122471755</id><published>2008-05-27T02:23:00.000-07:00</published><updated>2008-05-27T02:30:59.997-07:00</updated><title type='text'>OPENDATASOURCE</title><content type='html'>It provides ad hoc connection information as part of four – part object name without using a linked server name.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;OPENDATASOURCE(   provider_name, init_string )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;provider_name&lt;/strong&gt; is the name registered as the PROGID of the OLE DB provider used to access the data source. &lt;strong&gt;provider_name&lt;/strong&gt; is a char data type, with no default value.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;init_string &lt;/strong&gt;is the connection string passed to the &lt;strong&gt;IDataInitialize&lt;/strong&gt; interface of the destination provider. The provider string syntax is based on keyword-value pairs separated by semicolons, that is, "keyword1=value; keyword2=value."&lt;br /&gt;&lt;br /&gt;The following lists the most commonly used keywords in the &lt;strong&gt;init_string&lt;/strong&gt; argument.&lt;br /&gt;&lt;br /&gt;Keyword : Data Source&lt;br /&gt;OLE DB property : DBPROP_INIT_DATASOURCE&lt;br /&gt;Valid values and Description :&lt;br /&gt;         Name of the data source to connect to. Different providers interpret this in different ways. For SQL Server OLE DB provider, this indicates the name of the server. For Jet OLE DB provider, this indicates the full path of the .mdb file or .xls file.&lt;br /&gt;&lt;br /&gt;Keyword  : Location&lt;br /&gt;OLE DB property : DBPROP_INIT_LOCATION&lt;br /&gt;Valid values and Description : Location of the database to connect to.&lt;br /&gt;&lt;br /&gt;Keyword  : Extended Properties&lt;br /&gt;OLE DB property : DBPROP_INIT_PROVIDERSTRING&lt;br /&gt;Valid values and Description : The provider-specific connect-string.&lt;br /&gt;&lt;br /&gt;Keyword  : Connect timeout&lt;br /&gt;OLE DB property : DBPROP_INIT_TIMEOUT&lt;br /&gt;Valid values and Description : Time-out value after which the connection attempt fails.&lt;br /&gt;&lt;br /&gt;Keyword  : User ID&lt;br /&gt;OLE DB property : DBPROP_AUTH_USERID&lt;br /&gt;Valid values and Description : User ID to be used for the connection.&lt;br /&gt;&lt;br /&gt;Keyword  : Password&lt;br /&gt;OLE DB property : DBPROP_AUTH_PASSWORD&lt;br /&gt;Valid values and Description : Password to be used for the connection.&lt;br /&gt;&lt;br /&gt;Keyword  : Catalog&lt;br /&gt;OLE DB property : DBPROP_INIT_CATALOG&lt;br /&gt;Valid values and Description : The name of the initial or default catalog when connecting to the data source.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;br /&gt;This example accesses data from a table on another instance of SQL Server.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT * FROM OPENDATASOURCE('SQLOLEDB','Data Source=ServerName;User ID=MyUID;Password=MyPass').Northwind.dbo.Categories&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is an example of a query against an Excel spreadsheet through the OLE DB provider for Jet.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...xactions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3203947156122471755?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3203947156122471755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3203947156122471755' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3203947156122471755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3203947156122471755'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/05/opendatasource.html' title='OPENDATASOURCE'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1432484588437115115</id><published>2008-05-27T02:10:00.000-07:00</published><updated>2008-05-27T02:12:57.677-07:00</updated><title type='text'>How to import data from Excel to SQL Server?</title><content type='html'>We can import data from Excel to SQL Server by using &lt;strong&gt;SQL Server distributed&lt;/strong&gt; queries.&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;We can import data for a specific purpose by using the &lt;strong&gt;OPENDATASOURCE&lt;/strong&gt; or the &lt;strong&gt;OPENROWSET&lt;/strong&gt; function. The following code samples will help us to import data from excel customer’s worksheet into new SQL Server tables.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT * INTO tblXLImport1 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\test.xls;Extended Properties=Excel 8.0')...[Customers$]&lt;br /&gt;&lt;br /&gt;SELECT * INTO tblXLImport2 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls', [Customers$])&lt;br /&gt;&lt;br /&gt;SELECT * INTO tblXLImport3 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls', 'SELECT * FROM [Customers$]')&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;//Here Customers$ means the name of worksheet.&lt;/div&gt;&lt;div align="justify"&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;Simple sample query:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',&lt;br /&gt;'Data Source=C:\students.xls;Extended Properties=Excel 8.0')...[Students$]&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;&lt;/span&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1432484588437115115?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1432484588437115115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1432484588437115115' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1432484588437115115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1432484588437115115'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/05/how-to-import-data-from-excel-to-sql.html' title='How to import data from Excel to SQL Server?'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6104036799541234401</id><published>2008-04-18T11:36:00.000-07:00</published><updated>2008-04-18T11:39:02.818-07:00</updated><title type='text'>Simple Cursor Programme</title><content type='html'>Hi all,&lt;br /&gt;Here is a simple sample for cursor.&lt;br /&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;declare testCur CURSOR For //Cursor declaring for&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;select top 10 * from tblUsers&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;Open testCur //Open the cursor&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;Fetch next from testCur //Fetch the first record&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;while @@FETCH_STATUS = 0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;Fetch next from testCur //Fetch the next record while status = 0&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;CLOSE testCur //Close cursor&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ffffcc;"&gt;deallocate testCur //Deallocate the cursor.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6104036799541234401?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6104036799541234401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6104036799541234401' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6104036799541234401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6104036799541234401'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/04/simple-cursor-programme.html' title='Simple Cursor Programme'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2958852059500266895</id><published>2008-04-18T11:24:00.000-07:00</published><updated>2008-04-18T11:34:56.573-07:00</updated><title type='text'>Grant permission to all stored procedures.</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;I am continuing my posts here for a long gape...&lt;br /&gt;&lt;br /&gt;Here is a query for granting permission to all stored procedures in a database. Check it out...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;create PROCEDURE stpGrantPermissionToAllSP @user sysname&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;AS&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;-- 1 - Variable declarations&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DECLARE @CMD1 varchar(8000)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DECLARE @MAXOID int&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DECLARE @OwnerName varchar(128)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DECLARE @ObjectName varchar(128) &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 2 - Create temporary table&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;CREATE TABLE #StoredProcedures&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;(OID int IDENTITY (1,1),&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;StoredProcOwner varchar(128) NOT NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;StoredProcName varchar(128) NOT NULL) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 3 - Populate temporary table&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;INSERT INTO #StoredProcedures (StoredProcOwner, StoredProcName)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT u.[Name], o.[Name]&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;FROM dbo.sysobjects o&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;INNER JOIN dbo.sysusers u&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;ON o.uid = u.uid&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;WHERE o.Type = 'P'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;AND o.[Name] NOT LIKE 'dt_%' &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 4 - Capture the @MAXOID value&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT @MAXOID = MAX(OID) FROM #StoredProcedures &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 5 - WHILE loop&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;WHILE @MAXOID &gt; 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;BEGIN &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 6 - Initialize the variables&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT @OwnerName = StoredProcOwner,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;@ObjectName = StoredProcName&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;FROM #StoredProcedures&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;WHERE OID = @MAXOID &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 7 - Build the string&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SELECT @CMD1 = 'GRANT EXEC ON ' + '[' + @OwnerName + ']' + '.' + '[' + @ObjectName + ']' + ' TO ' + @user &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 8 - Execute the string&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- SELECT @CMD1&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 9 - Decrement @MAXOID&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;SET @MAXOID = @MAXOID - 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;END &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;-- 10 - Drop the temporary table&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;DROP TABLE #StoredProcedures&lt;br /&gt;SET NOCOUNT OFF&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;GO&lt;br /&gt;exec stpGrantPermissionToAllSP 'username'&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2958852059500266895?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2958852059500266895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2958852059500266895' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2958852059500266895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2958852059500266895'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/04/grant-permission-to-all-stored.html' title='Grant permission to all stored procedures.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3290588687906979054</id><published>2008-03-13T22:49:00.000-07:00</published><updated>2008-03-13T22:52:49.857-07:00</updated><title type='text'>DataTable,DataRow,DataView sorting.</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Just check the data sorting by using dataview in below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;SqlConnection sql=new SqlConnection("Connection String");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            SqlCommand cmd=new SqlCommand("SampleProcedure",sql);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            cmd.CommandType=CommandType.StoredProcedure;            &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            SqlDataAdapter da=new SqlDataAdapter(cmd);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            DataSet ds=new DataSet();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            da.Fill(ds);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            if(ds.Tables[0].Rows.Count&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                DataTable dt=new DataTable();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                dt.Columns.Add("Score",typeof(double));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                dt.Columns.Add("Name",typeof(string));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                DataRow dr;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                foreach(DataRow drow in ds.Tables[0].Rows)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    dr = dt.NewRow();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    dr["Score"] = drow ["intScore"];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    dr["Name"]=drow ["strGameName"];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                    dt.Rows.Add(dr);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                DataView dv=dt.DefaultView;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;           &lt;span style="color: rgb(255, 255, 102);"&gt;     dv.Sort="Score desc";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                DataGrid drg=new DataGrid();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                drg.DataSource=dv; //drg is DataGrid&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                drg.DataBind();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;                this.Controls.Add(drg);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.VinothkumaR&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3290588687906979054?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3290588687906979054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3290588687906979054' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3290588687906979054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3290588687906979054'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/03/datatabledatarowdataview-sorting.html' title='DataTable,DataRow,DataView sorting.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8264503585600123552</id><published>2008-03-13T22:42:00.000-07:00</published><updated>2008-03-13T22:44:42.218-07:00</updated><title type='text'>Double Formatting.</title><content type='html'>Here is sample for double formatting by using C#.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;Double dblScore = 2.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;string str = dblScore.ToString("#,##0.0;(#,##0.0);00.0");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;...S.Vinothkumar.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8264503585600123552?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8264503585600123552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8264503585600123552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8264503585600123552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8264503585600123552'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/03/double-formatting.html' title='Double Formatting.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2704275664029203355</id><published>2008-01-24T21:32:00.000-08:00</published><updated>2008-01-24T21:34:06.731-08:00</updated><title type='text'>Check the valid Email Address using JavaScript</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Use the following code for check the valid email address.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;var filterEmail  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z])+\.)+([a-zA-Z]{2,4})+$/; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;  if(filterEmail.test(Email))//Check the Email Format.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;//..........&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2704275664029203355?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2704275664029203355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2704275664029203355' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2704275664029203355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2704275664029203355'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/01/check-valid-email-address-using.html' title='Check the valid Email Address using JavaScript'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8889770398724964652</id><published>2008-01-24T21:30:00.000-08:00</published><updated>2008-01-24T21:32:03.409-08:00</updated><title type='text'>Check the phone number for valid using JavaScript</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Use the following code for checking the valid phone number.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt; var filter  = /^([0-9])+$/; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt; if (filter.test(textValue))  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt; // ...Code here&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8889770398724964652?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8889770398724964652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8889770398724964652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8889770398724964652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8889770398724964652'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/01/check-phone-number-for-valid-using.html' title='Check the phone number for valid using JavaScript'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2621610333498399261</id><published>2008-01-24T21:27:00.000-08:00</published><updated>2008-01-24T21:29:17.669-08:00</updated><title type='text'>Checking the Name for valid Characters in JavaScript</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Use the following code for check the valid characters in name field.&lt;br /&gt;&lt;br /&gt;var  filter  = /^([a-zA-Z',.\0-9 ])+$/; &lt;br /&gt; if (filter.test(textValue)) &lt;br /&gt;{&lt;br /&gt;// ...Code here&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2621610333498399261?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2621610333498399261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2621610333498399261' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2621610333498399261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2621610333498399261'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2008/01/checking-name-for-valid-characters-in.html' title='Checking the Name for valid Characters in JavaScript'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4740665372809087591</id><published>2007-12-20T06:18:00.000-08:00</published><updated>2007-12-20T06:23:57.139-08:00</updated><title type='text'>Getting Drive Volume Information in C#</title><content type='html'>It's very easy to getting Volume Information of our logical drives by using kernel32.dll&lt;br /&gt;&lt;br /&gt;Just copy and paste the following code then run it...that's it. :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.Runtime.InteropServices;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;[DllImport("kernel32.dll", CharSet = CharSet.Auto)]&lt;br /&gt;static extern bool GetVolumeInformation(string Volume,&lt;br /&gt;StringBuilder VolumeName, uint VolumeNameSize,&lt;br /&gt;out uint SerialNumber, out uint SerialNumberLength, out uint flags,&lt;br /&gt;StringBuilder fs, uint fs_size);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;uint serialNum, serialNumLength, flags;&lt;br /&gt;StringBuilder volumename = new StringBuilder(256);&lt;br /&gt;StringBuilder fstype = new StringBuilder(256);&lt;br /&gt;bool ok = false;&lt;br /&gt;Cursor.Current = Cursors.WaitCursor;&lt;br /&gt;foreach (string drives in Environment.GetLogicalDrives())&lt;br /&gt;{&lt;br /&gt;ok = GetVolumeInformation(drives, volumename, (uint)volumename.Capacity - 1, out serialNum,&lt;br /&gt;out serialNumLength, out flags, fstype, (uint)fstype.Capacity - 1);&lt;br /&gt;if (ok)&lt;br /&gt;{&lt;br /&gt;lblVolume.Text = lblVolume.Text + "\n Volume Information of " + drives + "\n";&lt;br /&gt;lblVolume.Text = lblVolume.Text + "\nSerialNumber of is..... " + serialNum.ToString() + " \n";&lt;br /&gt;if (volumename != null)&lt;br /&gt;{&lt;br /&gt;lblVolume.Text = lblVolume.Text + "VolumeName is..... " + volumename.ToString() + " \n";&lt;br /&gt;}&lt;br /&gt;if (fstype != null)&lt;br /&gt;{&lt;br /&gt;lblVolume.Text = lblVolume.Text + "FileType is..... " + fstype.ToString() + " \n";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;ok = false;&lt;br /&gt;}&lt;br /&gt;Cursor.Current = Cursors.Default;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this will helpful to you....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#993300;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4740665372809087591?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4740665372809087591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4740665372809087591' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4740665372809087591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4740665372809087591'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/12/getting-drive-volume-information-in-c.html' title='Getting Drive Volume Information in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1950133752704227631</id><published>2007-12-19T02:44:00.000-08:00</published><updated>2007-12-19T02:53:30.303-08:00</updated><title type='text'>Nokia Secret Codes</title><content type='html'>&lt;p&gt;*#06# for checking the IMEI (International Mobile Equipment Identity).&lt;/p&gt;&lt;p&gt;*#7780# reset to factory settings.&lt;/p&gt;&lt;p&gt;*#67705646# This will clear the LCD display(operator logo).&lt;/p&gt;&lt;p&gt;*#0000# To view software version.&lt;/p&gt;&lt;p&gt;*#2820# Bluetooth device address.&lt;/p&gt;&lt;p&gt;*#746025625# Sim clock allowed status.&lt;/p&gt;&lt;p&gt;#pw+1234567890+1# Shows if sim have restrictions.&lt;/p&gt;&lt;p&gt;*#92702689# - takes you to a secret menu where you may find some of the information below:&lt;/p&gt;&lt;p&gt;1. Displays Serial Number.&lt;/p&gt;&lt;p&gt;2. Displays the Month and Year of Manufacture&lt;/p&gt;&lt;p&gt;3. Displays (if there) the date where the phone was purchased (MMYY)&lt;/p&gt;&lt;p&gt;4. Displays the date of the last repair - if found (0000)&lt;/p&gt;&lt;p&gt;5. Shows life timer of phone (time passes since last start)&lt;/p&gt;&lt;p&gt;*#3370# - Enhanced Full Rate Codec (EFR) activation. Increase signal strength, better signal reception. It also help if u want to use GPRS and the service is not responding or too slow. Phone battery will drain faster though.&lt;/p&gt;&lt;p&gt;*#3370* - (EFR) deactivation. Phone will automatically restart. Increase battery life by 30% because phone receives less signal from network.&lt;/p&gt;&lt;p&gt;*#4720# - Half Rate Codec activation.&lt;/p&gt;&lt;p&gt;*#4720* - Half Rate Codec deactivation. The phone will automatically restart&lt;/p&gt;&lt;p&gt;If you forgot wallet code for Nokia S60 phone, use this code reset: *#7370925538#&lt;/p&gt;&lt;p&gt;Note, your data in the wallet will be erased. Phone will ask you the lock code. Default lock code is: 12345&lt;/p&gt;&lt;p&gt;Press *#3925538# to delete the contents and code of wallet.&lt;/p&gt;&lt;p&gt;Unlock service provider: Insert sim, turn phone on and press vol up(arrow keys) for 3 seconds, should say pin code. Press C,then press * message should flash, press * again and 04*pin*pin*pin# \&lt;/p&gt;&lt;p&gt;*#7328748263373738# resets security code.&lt;/p&gt;&lt;p&gt;Default security code is 12345&lt;/p&gt;&lt;p&gt;Change closed caller group (settings &gt;security settings&gt;user groups) to 00000 and ure phone will sound the message tone when you are near a radar speed trap. Setting it to 500 will cause your phone 2 set off security alarms at shop exits, gr8 for practical jokes! (works with some of the Nokia phones.) Press and hold "0" on the main screen to open wap browser.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#993300;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1950133752704227631?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1950133752704227631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1950133752704227631' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1950133752704227631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1950133752704227631'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/12/nokia-secret-codes.html' title='Nokia Secret Codes'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4740480614206416764</id><published>2007-12-11T04:17:00.000-08:00</published><updated>2007-12-11T04:27:39.598-08:00</updated><title type='text'>Getting Disk Space using Management.</title><content type='html'>&lt;div&gt;Hi all,&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Here is I'm going to getting disk space and free space using WMI. For that we must add refference &lt;span style="color:#cc9933;"&gt;System.Management.dll&lt;/span&gt;. The below is coding ...check it out...&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;using System.Management;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;br /&gt;RadioButton rdDrives;&lt;br /&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;int i = 10;&lt;br /&gt;foreach (string drives in Environment.GetLogicalDrives())&lt;br /&gt;{&lt;br /&gt;rdDrives = new RadioButton();&lt;br /&gt;rdDrives.Text = drives;&lt;br /&gt;rdDrives.Top = i+20;&lt;br /&gt;this.Controls.Add(rdDrives);&lt;br /&gt;Application.DoEvents();&lt;br /&gt;i = i + 40;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void btnGetDiskSpace_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;string drive = "";&lt;br /&gt;RadioButton rd;&lt;br /&gt;//Control[] control = this.Controls.Find("RadioButton", false);&lt;br /&gt;for (int j = 0; j &lt; rd =" (RadioButton)this.Controls[j];" drive =" rd.Text;" drive =" drive.Substring(0,"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void getSize(string drive)&lt;br /&gt;{&lt;br /&gt;ManagementObject diskSize = new ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");&lt;br /&gt;diskSize.Get();&lt;br /&gt;lblSize.Text = "Disk Space in " + drive + " is :" + diskSize["Size"] + " bytes";&lt;br /&gt;lblFreeSpace.Text = "Free space in " +drive +" is :" + diskSize["FreeSpace"] + " bytes";&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;OutPut:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://bp1.blogger.com/_MTawyT4n2e4/R16CDgm___I/AAAAAAAAAoY/vmQ1CTZHZrY/s1600-h/getdiskspace.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5142690821308415986" style="CURSOR: hand" alt="" src="http://bp1.blogger.com/_MTawyT4n2e4/R16CDgm___I/AAAAAAAAAoY/vmQ1CTZHZrY/s320/getdiskspace.GIF" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;That's it..&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color:#993300;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4740480614206416764?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4740480614206416764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4740480614206416764' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4740480614206416764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4740480614206416764'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/12/getting-disk-space-using-management.html' title='Getting Disk Space using Management.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_MTawyT4n2e4/R16CDgm___I/AAAAAAAAAoY/vmQ1CTZHZrY/s72-c/getdiskspace.GIF' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3507053539793844235</id><published>2007-12-11T04:11:00.000-08:00</published><updated>2007-12-11T04:14:32.754-08:00</updated><title type='text'>Getting Disk Information using DriveInfo in C#</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;I'm going to display all disk's information (VolumeLable, File System, Total Space, FreeSpace ...etc). Here is the code...check it out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;DriveInfo[] allDrives = DriveInfo.GetDrives();&lt;br /&gt;Label lbl;&lt;br /&gt;int i = 0;&lt;br /&gt;foreach (DriveInfo d in allDrives)&lt;br /&gt;{&lt;br /&gt;lbl = new Label();&lt;br /&gt;lbl.AutoSize = true;&lt;br /&gt;lbl.Text = "Drive: " + d.Name.Substring(0,1) + "\n";&lt;br /&gt;lbl.Text = lbl.Text + "FileType: " + d.DriveType + "\n";&lt;br /&gt;if (d.IsReady)&lt;br /&gt;{&lt;br /&gt;lbl.Text = lbl.Text + "Volume label: " + d.VolumeLabel+ "\n";&lt;br /&gt;lbl.Text = lbl.Text + "File system: " + d.DriveFormat + "\n";&lt;br /&gt;lbl.Text = lbl.Text + "Available space to current user: " + d.AvailableFreeSpace + "bytes\n";&lt;br /&gt;lbl.Text = lbl.Text + "Total available space: " + d.TotalFreeSpace + "\n";&lt;br /&gt;lbl.Text = lbl.Text + "Total size of drive: " + d.TotalSize + "\n";&lt;br /&gt;}&lt;br /&gt;lbl.Top = i;&lt;br /&gt;this.Controls.Add(lbl);&lt;br /&gt;i = i + 110;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#990000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3507053539793844235?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3507053539793844235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3507053539793844235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3507053539793844235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3507053539793844235'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/12/getting-disk-information-using.html' title='Getting Disk Information using DriveInfo in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-557377423861475885</id><published>2007-11-29T22:04:00.000-08:00</published><updated>2007-11-29T22:06:35.490-08:00</updated><title type='text'>Convert .wav to .mp3 using Lame.exe in C#</title><content type='html'>&lt;span style="color:#ffffcc;"&gt;public void mciConvertWavMP3(string fileName, bool waitFlag)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;  //maxLen is in ms (1000 = 1 second)   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;string outfile= "-b 32 --resample 22.05 -m m \""+pworkingDir+fileName + "\" \"" + pworkingDir+fileName.Replace(".wav",".mp3")+"\"";   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;System.Diagnostics.ProcessStartInfo psi=new System.Diagnostics.ProcessStartInfo();   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;psi.FileName="\""+pworkingDir+"lame.exe"+"\"";   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;psi.Arguments=outfile;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;//psi.WorkingDirectory=pworkingDir;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;psi.WindowStyle=System.Diagnostics.ProcessWindowStyle.Minimized;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;System.Diagnostics.Process p=System.Diagnostics.Process.Start(psi);   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;if (waitFlag) &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;{    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;p.WaitForExit();  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;// wait for exit of called application      &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;}  &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This code will help us to convert .wav file in to .mp3&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-557377423861475885?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/557377423861475885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=557377423861475885' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/557377423861475885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/557377423861475885'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/convert-wav-to-mp3-using-lameexe-in-c.html' title='Convert .wav to .mp3 using Lame.exe in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3029965960881991345</id><published>2007-11-29T21:55:00.000-08:00</published><updated>2007-11-29T21:59:39.324-08:00</updated><title type='text'>Compress mp3 file using Lame.exe in C#</title><content type='html'>We can compress mp3 file using Lame.exe easily as follows. The following code will help us to reduce the mp3 file’s size without losing much more of quality. For that we need to put lame.exe file in our folder. Find lame.exe and download it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Code:&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void mp3Encode(string srcFileName, string targetFileName)&lt;br /&gt;{&lt;br /&gt;if (!string.IsNullOrEmpty(srcFileName) &amp;amp;&amp;amp;&lt;br /&gt;!string.IsNullOrEmpty(targetFileName))&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;string workingDir = AppDomain.CurrentDomain.BaseDirectory + "&lt;/span&gt;&lt;a href="file://msqueeze//"&gt;&lt;span style="color:#ffffcc;"&gt;\\&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#ffffcc;"&gt;";&lt;br /&gt;string outfile = "-V9 -q0 --resample 32 -B56 --verbose " + '"' + srcFileName + "\" \"" + &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;targetFileName + "\"";&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();&lt;br /&gt;psi.FileName = workingDir + "lame.exe";&lt;br /&gt;psi.Arguments = outfile;&lt;br /&gt;psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;&lt;br /&gt;p = System.Diagnostics.Process.Start(psi);&lt;br /&gt;while (p.HasExited == false)&lt;br /&gt;{&lt;br /&gt;Thread.Sleep(10);&lt;br /&gt;Application.DoEvents();&lt;br /&gt;}&lt;br /&gt;p.Dispose();&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;MessageBox.Show(ex.Message);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void frmConvertor_FormClosing(object sender, FormClosingEventArgs e)&lt;br /&gt;{&lt;br /&gt;if (p != null)&lt;br /&gt;{&lt;br /&gt;p.Dispose();&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope this will help us to reduce our mp3 file’s size…&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;....S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3029965960881991345?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3029965960881991345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3029965960881991345' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3029965960881991345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3029965960881991345'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/compress-mp3-file-using-lameexe-in-c.html' title='Compress mp3 file using Lame.exe in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-3189677568045036256</id><published>2007-11-29T21:46:00.000-08:00</published><updated>2007-11-29T21:47:48.796-08:00</updated><title type='text'>mciSendString in C#</title><content type='html'>The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.Runtime.InteropServices;&lt;br /&gt;&lt;br /&gt;[DllImport("winmm.dll")]&lt;br /&gt;        private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr oCallback);&lt;br /&gt;&lt;br /&gt;        public string playCommand;&lt;br /&gt;        public string fileName;&lt;br /&gt;        public bool isPlay = false;&lt;br /&gt;        public bool isStop = false;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void frmPlayer_Load(object sender, EventArgs e)&lt;br /&gt; {&lt;br /&gt;          if (!string.IsNullOrEmpty(fileName))&lt;br /&gt;                    {&lt;br /&gt;                        try&lt;br /&gt;                        {&lt;br /&gt;                            if (File.Exists(fileName))&lt;br /&gt;                                {&lt;br /&gt;                                    if (isPlay)&lt;br /&gt;                                    {&lt;br /&gt;                                        playCommand = "Close MediaFile";&lt;br /&gt;                                        mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                                        isPlay = false;&lt;br /&gt;                                        isStop = true;&lt;br /&gt;                                    }&lt;br /&gt;                                    playCommand = "open \"" + fileName + "\" type mpegvideo alias MediaFile";&lt;br /&gt;                                    mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                                    playCommand = "play MediaFile";&lt;br /&gt;                                    mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                                    isPlay = true;&lt;br /&gt;                                    btnPlayPlayer.Enabled = true;&lt;br /&gt;                                    btnPause.Enabled = true;&lt;br /&gt;                                    btnStop.Enabled = true;&lt;br /&gt;                                }&lt;br /&gt;                                else&lt;br /&gt;                                {&lt;br /&gt;                                    isPlay = false;&lt;br /&gt;                                    btnPlayPlayer.Enabled = false;&lt;br /&gt;                                    btnPause.Enabled = false;&lt;br /&gt;                                    btnStop.Enabled = false;&lt;br /&gt;                                    MessageBox.Show("Invalid File!");&lt;br /&gt;                                }&lt;br /&gt;                        }&lt;br /&gt;                        catch (Exception ex)&lt;br /&gt;                        {&lt;br /&gt;                            isPlay = false;&lt;br /&gt;                            btnPlayPlayer.Enabled = false;&lt;br /&gt;                            btnPause.Enabled = false;&lt;br /&gt;                            btnStop.Enabled = false;&lt;br /&gt;                            MessageBox.Show(ex.Message);&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;        private void btnPlayPlayer_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (!isPlay)&lt;br /&gt;            {&lt;br /&gt;                if (isStop)&lt;br /&gt;                {&lt;br /&gt;                    playCommand = "open \"" + fileName + "\" type mpegvideo alias MediaFile";&lt;br /&gt;                    mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                    playCommand = "play MediaFile";&lt;br /&gt;                    mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                    isPlay = true;&lt;br /&gt;                    isStop = false;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    playCommand = "play MediaFile";&lt;br /&gt;                    mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                    isPlay = true;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;private void btnPause_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (isPlay)&lt;br /&gt;            {&lt;br /&gt;                playCommand = "pause MediaFile";&lt;br /&gt;                mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                isPlay = false;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;private void btnStop_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (isPlay)&lt;br /&gt;            {&lt;br /&gt;                playCommand = "Close MediaFile";&lt;br /&gt;                mciSendString(playCommand, null, 0, IntPtr.Zero);&lt;br /&gt;                isPlay = false;&lt;br /&gt;                isStop = true;&lt;br /&gt;            }&lt;br /&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This coding will help us to play media file…&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;....S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-3189677568045036256?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/3189677568045036256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=3189677568045036256' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3189677568045036256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/3189677568045036256'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/mcisendstring-in-c.html' title='mciSendString in C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-4106431102338203607</id><published>2007-11-21T23:28:00.000-08:00</published><updated>2007-11-21T23:30:59.572-08:00</updated><title type='text'>Launch Configuration for Android application in Eclipse</title><content type='html'>Before you can run and debug your application in Eclipse, you must create a launch configuration for it. A launch configuration specifies the project to launch, the Activity to start, the emulator options to use, and so on.&lt;br /&gt;&lt;br /&gt;To create a launch configuration for the application, follow these steps:&lt;br /&gt;&lt;br /&gt;1. Select &lt;strong&gt;Run &lt;/strong&gt;&gt; &lt;strong&gt;Open Run Dialog&lt;/strong&gt;... or &lt;strong&gt;Run &lt;/strong&gt;&gt; &lt;strong&gt;Open Debug Dialog&lt;/strong&gt;... as appropriate.&lt;br /&gt;&lt;br /&gt;2. In the project type list on the left, right-click &lt;strong&gt;Android Application &lt;/strong&gt;and select &lt;strong&gt;New&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;3. Enter a name for your configuration.&lt;br /&gt;&lt;br /&gt;4. On the Android tab, browse for the project and Activity to start.&lt;br /&gt;&lt;br /&gt;5. On the Emulator tab, set the desired screen and network properties&lt;br /&gt;&lt;br /&gt;6. You can set additional options on the Common tab as desired.&lt;br /&gt;&lt;br /&gt;7. Press &lt;strong&gt;Apply &lt;/strong&gt;to save the launch configuration, or press &lt;strong&gt;Run &lt;/strong&gt;or &lt;strong&gt;Debug &lt;/strong&gt;(as appropriate).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;....S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-4106431102338203607?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/4106431102338203607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=4106431102338203607' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4106431102338203607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/4106431102338203607'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/launch-configuration-for-android.html' title='Launch Configuration for Android application in Eclipse'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-5177756309138706796</id><published>2007-11-21T23:24:00.000-08:00</published><updated>2007-11-21T23:27:50.949-08:00</updated><title type='text'>Creating an Android application in Eclipse</title><content type='html'>The ADT plugin provides a New Project Wizard that you can use to quickly create an Eclipse project for new or existing code. To create the project, follow these steps:&lt;br /&gt;&lt;a name="existingcode"&gt;&lt;/a&gt;&lt;br /&gt;1. Select &lt;strong&gt;File &lt;/strong&gt;&gt; &lt;strong&gt;New &lt;/strong&gt;&gt; &lt;strong&gt;Project&lt;/strong&gt;&lt;br /&gt;2. Select &lt;strong&gt;Android &lt;/strong&gt;&gt; &lt;strong&gt;Android Project&lt;/strong&gt;, and press &lt;strong&gt;Next&lt;/strong&gt;&lt;br /&gt;3. Select the contents for the project:&lt;br /&gt;&lt;br /&gt; - Select &lt;strong&gt;Create new project in workspace &lt;/strong&gt;to start a project for new code.&lt;br /&gt;&lt;br /&gt;   Enter the project name, the base package name, the name of a single Activity class to create as a stub .java file, and a name to use for your application.&lt;br /&gt;&lt;br /&gt; - Select &lt;strong&gt;Create project from existing source &lt;/strong&gt;to start a project from existing code. Use this option if you want to build and run any of the sample applications included with the SDK. The sample applications are located in the samples/ directory in the SDK.&lt;br /&gt;&lt;br /&gt;    Browse to the directory containing the existing source code and click OK. If the directory contains a valid Android manifest file, the ADT plugin fills in the package, activity, and application names for you.&lt;br /&gt;&lt;br /&gt;4. Press &lt;strong&gt;Finish&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;The ADT plugin creates the these folders and files for you as appropriate for the type of project:&lt;br /&gt;&lt;br /&gt; - src/   A folder that includes your stub .java Activity file.&lt;br /&gt; - res/   A folder for your resources.&lt;br /&gt; - AndroidManifest.xml   The manifest for your project.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;        .....S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-5177756309138706796?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/5177756309138706796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=5177756309138706796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5177756309138706796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/5177756309138706796'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/creating-android-application-in-eclipse.html' title='Creating an Android application in Eclipse'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8560554980923369318</id><published>2007-11-21T23:13:00.000-08:00</published><updated>2007-11-21T23:23:00.399-08:00</updated><title type='text'>Download and Install Android SDK</title><content type='html'>You can download the Android SDK at &lt;a href="http://code.google.com/android/download.html"&gt;here...&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We can develop Android application using eclipse IDE. For that we have to update the eclipse plugin as follows.&lt;br /&gt;&lt;br /&gt;1. Start Eclipse, then select &lt;strong&gt;Help&lt;/strong&gt; &gt; &lt;strong&gt;Software Updates&lt;/strong&gt; &gt;&lt;strong&gt; Find and Install&lt;/strong&gt;....&lt;br /&gt;&lt;br /&gt;2. In the dialog that appears, select &lt;strong&gt;Search for new features to install&lt;/strong&gt; and press &lt;strong&gt;Next&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;3. Press &lt;strong&gt;New Remote Site&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;4. In the resulting dialog box, enter a name for the remote site (e.g. &lt;strong&gt;Android Plugin&lt;/strong&gt;) and enter this as its URL:&lt;br /&gt;&lt;br /&gt;     &lt;a href="https://dl-ssl.google.com/android/eclipse/"&gt;https://dl-ssl.google.com/android/eclipse/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Press &lt;strong&gt;OK&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;5. You should now see the new site added to the search list (and checked). Press &lt;strong&gt;Finish&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;6. In the subsequent Search Results dialog box, select the checkbox for &lt;strong&gt;Android Plugin&lt;/strong&gt; &gt; &lt;strong&gt;Eclipse Integration&lt;/strong&gt; &gt; &lt;strong&gt;Android Development Tools &lt;/strong&gt;and press &lt;strong&gt;Next&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;7. Read the license agreement and then select &lt;strong&gt;Accept terms of the license agreement&lt;/strong&gt;, if appropriate. Press &lt;strong&gt;Next&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;8. Press &lt;strong&gt;Finish&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;9. The ADT plugin is not signed; you can accept the installation anyway by pressing &lt;strong&gt;Install All&lt;/strong&gt;.&lt;br /&gt;10. Restart Eclipse.&lt;br /&gt;&lt;br /&gt;11. After restart, &lt;strong&gt;update your Eclipse preferences&lt;/strong&gt; to point to the SDK directory:&lt;br /&gt;&lt;br /&gt; a) Select &lt;strong&gt;Window&lt;/strong&gt; &gt; &lt;strong&gt;Preferences&lt;/strong&gt;... to open the Preferences panel. (Mac OS X: &lt;strong&gt;Eclipse&lt;/strong&gt; &gt; &lt;strong&gt;Preferences&lt;/strong&gt;)&lt;br /&gt;&lt;br /&gt; b) Select &lt;strong&gt;Android&lt;/strong&gt; from the left panel.&lt;br /&gt;&lt;br /&gt; c) For the SDK Location in the main panel, press &lt;strong&gt;Browse&lt;/strong&gt;... and locate the SDK directory.&lt;br /&gt;&lt;br /&gt; d) Press &lt;strong&gt;Apply&lt;/strong&gt;, then &lt;strong&gt;OK&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Updating the ADT Plugin&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To update the ADT plugin to the latest version, follow these steps:&lt;br /&gt;&lt;br /&gt;1. Select &lt;strong&gt;Help &lt;/strong&gt;&gt; &lt;strong&gt;Software Updates &lt;/strong&gt;&gt; &lt;strong&gt;Find and Install&lt;/strong&gt;....&lt;br /&gt;2. Select &lt;strong&gt;Search for updates of the currently installed features &lt;/strong&gt;and press &lt;strong&gt;Finish&lt;/strong&gt;.&lt;br /&gt;3. If any update for ADT is available, select and &lt;strong&gt;install&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Alternatively,&lt;br /&gt;&lt;br /&gt;1. Select &lt;strong&gt;Help &lt;/strong&gt;&gt; &lt;strong&gt;Software Updates &lt;/strong&gt;&gt; &lt;strong&gt;Manage Configuration&lt;/strong&gt;.&lt;br /&gt;2. Navigate down the tree and select &lt;strong&gt;Android Development Tools&lt;/strong&gt; &lt;strong&gt;&lt;version&gt; &lt;/strong&gt;&lt;br /&gt;3. Select &lt;strong&gt;Scan for Updates &lt;/strong&gt;under &lt;strong&gt;Available Tasks&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;That's it...&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;   ...S.VinothkumaR.&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8560554980923369318?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8560554980923369318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8560554980923369318' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8560554980923369318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8560554980923369318'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/download-and-install-android-sdk.html' title='Download and Install Android SDK'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-6698911779598357488</id><published>2007-11-21T23:10:00.000-08:00</published><updated>2007-11-21T23:12:49.133-08:00</updated><title type='text'>Android</title><content type='html'>The &lt;a href="http://code.google.com/android/what-is-android.html"&gt;Android platform&lt;/a&gt; is a software stack for mobile devices including an operating system, middleware and key applications. Developers can create applications for the platform using the Android SDK. Applications are written using the Java programming language and run on Dalvik, a custom virtual machine designed for embedded use which runs on top of a Linux kernel.&lt;br /&gt;&lt;br /&gt;If you want to know how to develop applications for Android, you can visit the &lt;a href="http://code.google.com/android/documentation.html"&gt;google android page...&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-6698911779598357488?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/6698911779598357488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=6698911779598357488' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6698911779598357488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/6698911779598357488'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/android.html' title='Android'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8548182678373630008</id><published>2007-11-21T22:34:00.000-08:00</published><updated>2007-11-21T22:38:17.132-08:00</updated><title type='text'>Image Uploading in ASP.NET using C#</title><content type='html'>This is way I’m trying to explain an image uploading in asp.net using C#.&lt;br /&gt;&lt;br /&gt;Here is I’m going to post image in to an url with image byte array. On there a page will save that image byte array in to image in given path.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;POST IMAGE&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;As I mentioned above, the following method is going to use post image.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.Net;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Drawing.Imaging;&lt;br /&gt;using System.Drawing;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffcc99;"&gt;private void postImage()&lt;br /&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;HttpWebRequest request;&lt;br /&gt;request = (HttpWebRequest)HttpWebRequest.Create("url");&lt;br /&gt;request.KeepAlive = true;&lt;br /&gt;request.Method = "POST";&lt;br /&gt;byte[] byteArray = ConvertImageToByteArray((System.Drawing.Image)new Bitmap(@"C:\test.jpg"), ImageFormat.Jpeg);&lt;br /&gt;request.ContentType = "image/JPEG";&lt;br /&gt;request.ContentLength = byteArray.Length;&lt;br /&gt;Stream newStream = request.GetRequestStream();&lt;br /&gt;newStream.Write(byteArray, 0, byteArray.Length);&lt;br /&gt;newStream.Close();&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ffcc99;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffcc99;"&gt;private static byte[] ConvertImageToByteArray(System.Drawing.Image imageToConvert,ImageFormat formatOfImage)&lt;br /&gt;    {&lt;br /&gt;&lt;/span&gt;       &lt;span style="color:#ffffcc;"&gt; byte[] Ret;&lt;br /&gt;&lt;/span&gt;       &lt;span style="color:#ffcc99;"&gt; try&lt;br /&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;           &lt;span style="color:#ffffcc;"&gt; using (MemoryStream ms = new MemoryStream())&lt;br /&gt;&lt;/span&gt;            &lt;span style="color:#ffcc99;"&gt;{&lt;br /&gt;&lt;/span&gt;                &lt;span style="color:#ffffcc;"&gt;imageToConvert.Save(ms, formatOfImage);&lt;br /&gt;                Ret = ms.ToArray();&lt;br /&gt;&lt;/span&gt;            &lt;span style="color:#ffcc99;"&gt;}&lt;br /&gt;        }&lt;br /&gt;&lt;/span&gt;        &lt;span style="color:#ffcc99;"&gt;catch (Exception) { throw; }&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:#ffffcc;"&gt; return Ret;&lt;br /&gt;&lt;/span&gt; &lt;span style="color:#ffcc99;"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From above the method postImage() will post the image in to given url as byte array. And the method ConvertImageToByteArray(System.Drawing.Image imageToConvert,ImageFormat formatOfImage) will help us for getting byte array from an image.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;UPLOAD IMAGE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The following code will help us save the image….&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;using System.IO;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Drawing.Imaging;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.Text;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffcc99;"&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#ffffcc;"&gt;try&lt;br /&gt;   {&lt;br /&gt;string dirPath = Server.MapPath("Asset") + "\\" ;&lt;br /&gt;Guid imgId = Guid.NewGuid(); &lt;br /&gt;string imgPath = dirPath + "\\" + imgId.ToString() + ".jpg";&lt;br /&gt;Response.ContentType = "image/JPEG";&lt;br /&gt;System.Drawing.Image img = Bitmap.FromStream(Page.Request.InputStream);&lt;br /&gt;img.Save(imgPath, ImageFormat.Jpeg);&lt;br /&gt;   }&lt;br /&gt; catch { }&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ffcc99;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it....&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;strong&gt;...S.VinothkumaR.&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-8548182678373630008?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/8548182678373630008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=8548182678373630008' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8548182678373630008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/8548182678373630008'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/image-uploading-in-aspnet-using-c.html' title='Image Uploading in ASP.NET using C#'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-1971054964121327393</id><published>2007-11-21T22:29:00.000-08:00</published><updated>2007-11-21T22:34:38.503-08:00</updated><title type='text'>Getting byte array from an image.</title><content type='html'>&lt;span style="color:#ffffcc;"&gt;private static byte[] ConvertImageToByteArray(System.Drawing.Image imageToConvert,ImageFormat formatOfImage)&lt;br /&gt;    {&lt;br /&gt;        byte[] Ret;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            using (MemoryStream ms = new MemoryStream())&lt;br /&gt;            {&lt;br /&gt;                imageToConvert.Save(ms, formatOfImage);&lt;br /&gt;                Ret = ms.ToArray();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (Exception) { throw; }&lt;br /&gt;&lt;br /&gt;        return Ret;&lt;br /&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-1971054964121327393?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/1971054964121327393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=1971054964121327393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1971054964121327393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/1971054964121327393'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/getting-byte-array-from-image.html' title='Getting byte array from an image.'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-176174672405611005</id><published>2007-11-15T04:30:00.000-08:00</published><updated>2007-11-15T05:19:48.482-08:00</updated><title type='text'>Boxing And UnBoxing</title><content type='html'>Boxing and Unboxing are two important portions of .NET technology. Boxing is nothing but converting a value type object to a reference type object. Unboxing is completely explicit.&lt;br /&gt;&lt;br /&gt;Now let us get an idea regarding reference type and value type objects. We all know that a new operator returns the memory address of an object that is allocated from the managed memory (a pool of memory). We usually store this address in a variable for our convenience. These types of variables are known as reference variables. However, the value type variables are not supposed to have the references; they always used to have the object itself and not the reference to it.&lt;br /&gt;&lt;br /&gt;Now if we consider the statement written above in Listing 3, the C# compiler will detect System.Int32 as a value type and the object is not allocated from the memory heap, assuming this as an unmanaged one.&lt;br /&gt;&lt;br /&gt;In a general way we should declare a type as a value type if the following are true.&lt;br /&gt;&lt;br /&gt;1. The type should be a primitive type.&lt;br /&gt;2. The type does not need to be inherited from any other types available.&lt;br /&gt;3. No other types should also be derived from it.&lt;br /&gt;&lt;br /&gt;This example shows how an integer type is converted to a reference type using the boxing and then unboxed from the object type to the integer type.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;class Test&lt;br /&gt;{&lt;br /&gt;  static void Main()&lt;br /&gt;  {&lt;br /&gt;    int i = 1; // i is an integer. It is a value type variable.&lt;br /&gt;    object o = i;&lt;br /&gt;      // boxing is happening. The integer type is parsed to //object type&lt;br /&gt;    int j = (int)o;&lt;br /&gt;      // unboxing is happening. The object type is unboxed to //the value type&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-176174672405611005?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/176174672405611005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=176174672405611005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/176174672405611005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/176174672405611005'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/boxing-and-unboxing.html' title='Boxing And UnBoxing'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-315290702367282472</id><published>2007-11-15T01:43:00.000-08:00</published><updated>2007-11-15T01:56:38.328-08:00</updated><title type='text'>Leap Year checking in Javascript</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Here is I'm going to check the given year is leap or not...How to do....check it out..&lt;br /&gt;&lt;br /&gt;I don't state that this code is perfect but it does work.&lt;br /&gt;&lt;br /&gt;Just copy and paste the following function in to script tag inside the header tag so that it can be called from anywhere in this HTML document.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;function isleap()&lt;br /&gt;{&lt;br /&gt;var yr=document.getElementById("year").value;&lt;br /&gt;if ((parseInt(yr)%4) == 0)&lt;br /&gt;{&lt;br /&gt;if (parseInt(yr)%100 == 0)&lt;br /&gt;{&lt;br /&gt;if (parseInt(yr)%400 != 0)&lt;br /&gt;{&lt;br /&gt;alert("Not Leap");&lt;br /&gt;return "false";&lt;br /&gt;}&lt;br /&gt;if (parseInt(yr)%400 == 0)&lt;br /&gt;{&lt;br /&gt;alert("Leap");&lt;br /&gt;return "true";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;if (parseInt(yr)%100 != 0)&lt;br /&gt;{&lt;br /&gt;alert("Leap");&lt;br /&gt;return "true";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;if ((parseInt(yr)%4) != 0)&lt;br /&gt;{&lt;br /&gt;alert("Not Leap");&lt;br /&gt;return "false";&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically this code gives the rules to check if a year is a leap year. If the year is no divisible by 4 then it is not a leap year. If the year is divisible by 100 but not by 400 then it is not a leap year. Otherwise the remaining options leave us with a leap year so I hard coded what to do. The Reason I have coded in what to do otherwise is to highlight the two different statements of verifying that something does match and verifying something does not match.&lt;br /&gt;&lt;br /&gt;Just call this script function where you want...as follows,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ffffcc;"&gt;onclick="isleap()"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;that's it....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;...S.VinothkumaR.&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-315290702367282472?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/315290702367282472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=315290702367282472' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/315290702367282472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/315290702367282472'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/leap-year-checking-in-javascript.html' title='Leap Year checking in Javascript'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-2560039633675324568</id><published>2007-11-13T05:51:00.000-08:00</published><updated>2007-11-13T05:59:10.079-08:00</updated><title type='text'>Caching in ASP.NET 2.0</title><content type='html'>Here is the different kind of caching that you can use in your web applications:   &lt;p class="MsoNormal"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Output Caching &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Fragment Caching &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Data Caching &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Cache Configuration&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;h2&gt;Output Caching&lt;/h2&gt;  &lt;p style="text-align: justify;"&gt;Performance is improved in an ASP.NET application by caching the rendered markup and serving the cached version of the markup until the cache expires. For example, if you have a page that displays user information from a database, caching will help improve performance by serving the page from memory instead of making a connection to the database on each page request. &lt;/p&gt;  &lt;p style="text-align: justify;"&gt;You can cache a page by using the OutputCache API or simply by using the &lt;a href="http://msdn2.microsoft.com/en-us/library/hdxfb6cy.aspx"&gt;@OutputCache&lt;/a&gt; directive. &lt;/p&gt;  &lt;pre&gt;&lt;%@ Page Language=”C#” %&gt;&lt;/pre&gt; &lt;pre&gt;&lt;%@ OutputCache Duration=”15” VaryByParam=”none” %&gt;&lt;/pre&gt;  &lt;p&gt;The above cache directive will cache the page for 15 minutes. &lt;/p&gt;  &lt;p&gt;So output caching is great for when you want to cache an entire page. &lt;/p&gt;  &lt;h2&gt;Fragment Caching&lt;/h2&gt;   &lt;p style="text-align: justify;"&gt;In many situations caching the entire page just isn’t going to cut it, for some reason or another you require specific sections of the page to display live information. One way to improve performance is to analyze your page and identify objects that require a substantial overhead to run. You can build a list of these objects that are expensive to run, and then cache them for a period of time using fragment caching. &lt;/p&gt;    &lt;p style="text-align: justify;"&gt;For example, say your page default.aspx consists of three user controls. After looking over the code, you identified that you can cache one of them. You can simply add the caching directive to the top of the user control: &lt;/p&gt;  &lt;pre&gt;&lt;%@ Control %&gt;&lt;/pre&gt; &lt;pre&gt;&lt;%@ OutputCache Duration=”5” VaryByParam=”none” %&gt;&lt;/pre&gt;   &lt;p style="text-align: justify;"&gt;Now keep in mind that the actual page that contains the control is not cached, only the user control. This means that the default.aspx page will be rendered each and every page request, but the user control is only ‘run’ every 15 minutes. &lt;/p&gt;  &lt;h2&gt;Data Caching&lt;/h2&gt;   &lt;p style="text-align: justify;"&gt;So we know that we can cache an entire page, or a fragment of a page by caching down to the user control level. Wouldn’t it be great if we could cache down to the object level? The good news is you can with ASP.NET Data caching. &lt;/p&gt;  &lt;p style="text-align: justify;"&gt;The cache consists of a dictionary collection that is private to each application in memory. To insert items in the cache simply provide the collection with a unique name: &lt;/p&gt;  &lt;pre&gt;Cache[“someKey”] = myObject;&lt;/pre&gt;   &lt;p&gt;Retrieving the object form the cache: &lt;/p&gt;  &lt;pre&gt;myObject = (MyObject)Cache[“someKey”];&lt;/pre&gt;  &lt;p style="text-align: justify;"&gt;It is a good time to point out that you should always remember to check for null, and be sure to caste to your datatype. &lt;/p&gt;    &lt;h2&gt;Cache Configuration&lt;/h2&gt;   &lt;p style="text-align: justify;"&gt;If you are familiar with how caching worked in ASP.NET 1.0, you realize that managing all the cache directions for all your pages could potentially get out of hand. ASP.NET 2.0 introduces Cache Profiles that helps you centrally manage your cache. Cache settings can be inherited by your pages, and overridden if required by using the OutputCache directive. &lt;/p&gt;   &lt;p style="text-align: justify;"&gt;The page directive looks pretty much the same, expect this time it references a cache profile that you defined in your web.config file.&lt;span style=""&gt;      &lt;/span&gt;&lt;span style=""&gt;             &lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_MTawyT4n2e4/Rzms_inqQ_I/AAAAAAAAAoQ/BIimS8zuXOE/s1600-h/cache.GIF"&gt;&lt;img style="cursor: pointer;" src="http://bp3.blogger.com/_MTawyT4n2e4/Rzms_inqQ_I/AAAAAAAAAoQ/BIimS8zuXOE/s320/cache.GIF" alt="" id="BLOGGER_PHOTO_ID_5132323457990280178" border="0" /&gt;&lt;/a&gt;&lt;/h2&gt; &lt;pre&gt;&lt;add name=" myCacheProfile1" duration="60"&gt;&lt;/add&gt;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;So each and every page that references the ‘myCacheProfile1’ can be centrally managed in the web.config, this means that any changes to the cache settings in the web.config file will be automatically changed on all your referenced pages. &lt;/p&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;     ...S.VinothkumaR.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7176498828566901874-2560039633675324568?l=vinothnat.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinothnat.blogspot.com/feeds/2560039633675324568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7176498828566901874&amp;postID=2560039633675324568' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2560039633675324568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7176498828566901874/posts/default/2560039633675324568'/><link rel='alternate' type='text/html' href='http://vinothnat.blogspot.com/2007/11/caching-in-aspnet-20.html' title='Caching in ASP.NET 2.0'/><author><name>Vinothkumar S</name><uri>http://www.blogger.com/profile/04076136185993269386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_MTawyT4n2e4/SLfEIHA99JI/AAAAAAAAAqc/r0PI0LXBj58/S220/2004543317664486665_rs.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_MTawyT4n2e4/Rzms_inqQ_I/AAAAAAAAAoQ/BIimS8zuXOE/s72-c/cache.GIF' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7176498828566901874.post-8204500810121223662</id><published>2007-11-13T05:21:00.000-08:00</published><updated>2007-11-13T05:23:19.899-08:00</updated><title type='text'>ASP.Net page life cycle</title><content type='html'>&lt;p class="MsoNormal"&gt;Here is I’m going to explain, &lt;span class="serif"&gt;behind the scenes when a ASP.NET page loads.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;span class="serif"&gt;In general, the life cycle of a ASP.NET page comprises of a series of steps like &lt;b style=""&gt;initialization&lt;/b&gt;, &lt;b style=""&gt;instantiation&lt;/b&gt; of controls, &lt;b style=""&gt;state management&lt;/b&gt;, the firing of &lt;b style=""&gt;event&lt;/b&gt; handler code, and the final stage of &lt;b style=""&gt;rendering&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;  &lt;/p&gt;&lt;p&gt;The following are the various stages a page goes through: &lt;/p&gt;  &lt;h3&gt;Page Request&lt;/h3&gt;  &lt;p&gt;The request page is either parsed or compiled, or fetched from the cache. &lt;/p&gt;  &lt;h3&gt;Start&lt;/h3&gt;  &lt;p style="text-align: justify;"&gt;Page properties like the Request and Response are set. The type of request is determined, specifically whether it is a new Request or it is a PostBack. Culturing properties are also determined via the pages ICulture property. &lt;/p&gt;    &lt;h3&gt;Page Initialization&lt;/h3&gt;  &lt;p style="text-align: justify;"&gt;All the controls on the given page are initialized with a UniqueID (please don’t confused this with the ID property as the UnqiueID is a unique, hierarchicial identifier which includes the server control’s naming container). Theming is also applied at this stage. &lt;/p&gt;  &lt;h3&gt;Load&lt;/h3&gt;  &lt;p style="text-align: justify;"&gt;If the current request is a PostBack, the data from the viewstate and control state is loaded to the appropriate properties of the controls. &lt;/p&gt;  &lt;h3&gt;Validation&lt;/h3&gt;  &lt;p&gt;The Validate method of all the validator controls are fired, which in turn sets the Boolean property IsValid of the controls. &lt;/p&gt;    &lt;h3&gt;Postback Event Handling&lt;/h3&gt;  &lt;p&gt;If the current request is a PostBack, all event handlers are called. &lt;/p&gt;  &lt;h3&gt;Rendering&lt;/h3&gt;  &lt;p&gt;ViewState data is saved for all the controls that have enabled viewstate. The Render method for all the controls is fired which writes its output to the OutputStream via a text writer. &lt;/p&gt;  &lt;h3&gt;Unload&lt;/h3&gt;  &lt;p&gt;Once the page has been rendered and sent, the Page’s properties are unloaded (cleanup time). &lt;/p&gt;  &lt;p&gt;So know you have a better understanding of the various stages of a ASP.NET pages life cycle, you should be aware that within each of the above stages there are events that you can hook into so that your code is fired at the exact time that you want it to. &lt;/p&gt;  &lt;p&gt;Event Wire-up is another important concept to understand. So Event wire-up is where ASP.NET looks for methods that match a naming convention (e.g. Page_Load, Page_Init, etc) , and these methods are automatically fired at the appropriate event. There is a page level attribute AutoEventWireup that can be set to either true or false to enable this behaviour. &lt;/p&gt;  &lt;p&gt;Below are some of the more popular events that you should understand as you will most likely be interested in them: &lt;/p&gt;    &lt;h3&gt;PreInit&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="serif"&gt;You can use this event to: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Create /recreate dynamic controls &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: Symbol;"&gt;·&lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span class="serif"&gt;Set a master page or theme dynamically &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
