Archive for WinForms

Dictionaries of HTML Codes

February 11, 2009 | 0 Comments

I wrote this class to help me do some screen scraping programs. It has two Dictionary objects. One contains the HTML codes and their text equivalents and the other contains the numeric HTML codes and their text equivalents.

Read more…

Filed Under: ASP.NET, WinForms

Capturing Outlook 2007′s New Mail and Reminder Events

February 3, 2009 | 2 Comments

Visual Studio 2008′s Outlook Add-in projects allows you to create add-ins that can customize almost any feature of Ms Outlook. Two useful events that can be captured are ReminderFire and NewMailEx. The first occurs before a reminder of a calendar item is executed. And the second occurs when a new email is received in the Inbox.

Read more…

Filed Under: WinForms

Reading Excel 2003 and 2007 Files Using OLEDB

January 30, 2009 | 37 Comments

excelreader
One of the feature of the application I’m working on these days is allowing the user to import data from Excel 2003 and 2007 files. After some research I found out that OLEDB is the only way to read both Excel formats without any problems.

Read more…

Filed Under: ASP.NET, WinForms

Lock, Sleep or Hibernate Windows using C#

January 28, 2009 | 4 Comments

I don’t think there is a Windows developer who has not done this with his or her favorite programming language. So here is the C# version. Putting Windows in Sleep or Hibernate mode can be done with one line of code using the Windows.Forms.Application object’s SetSuspendState method, and locking can be done using Win32′s LockWorkStation function.

Read more…

Filed Under: WinForms

Reading and Writing Text Files in C#

January 24, 2009 | 0 Comments

With all the DBMSs out there, text files are still widely used when developing applications. They are small, fast and do not require any library or application to be installed in the client machine. The System.IO.StreamReader and System.IO.StreamWriter are used to read and write text files to disk.

The following code demonstrates reading a file selected using the OpenFileDialog control and saving to a file using the SaveFileDialog control. The code works with the .NET Framework and Mono 2.0 and later.

Read more…

Filed Under: Mono 2.0, WinForms

How to Download a Web Page in WinForms

January 18, 2009 | 0 Comments

Sometimes a desktop application might need to download a web page to be displayed to the user or screen scrapped. I did this in my MoviePlay application to get the IMDb (The Internet Movie Database) page of the movie.

Read more…

Filed Under: WinForms