Category: WinForms

How to Get the Title of a Webpage in Windows Forms

How to Get the Title of a Webpage in Windows Forms

November 18, 2013 | By | Add a Comment

I’ve been working on a Windows Forms application that needs to, among other things, get the title of a webpage. I thought I might share it here in case someone else needs it.

Continue Reading

List Drives and Folders in a TreeView Using C#

List Drives and Folders in a TreeView Using C#

June 4, 2013 | By | 11 Comments

The .NET Framework makes it easy to read drive and folder details but it does not include a Windows Forms control to automatically list them other than the FolderBrowserDialog control.

Continue Reading

Displaying an Image Without Locking its File

July 5, 2010 | By | 4 Comments

The PictureBox control is one of the most used controls in Windows Forms applications. And sometimes you might want to delete the image file that is displayed on it. Doing so with an image displayed using the Image.FromFile function will result in a file locked exception. And file will stay locked until the program exits, […]

Continue Reading

Opening a File With its Default Program

July 1, 2010 | By | Add a Comment

When developing a Windows Forms application you sometimes need to open a file using the default program associated with it automatically for the user view or edit it. This could be done by just calling the System.Diagnostics.Process.Start function and passing the file name and path as a string. It works with any file type as […]

Continue Reading

Drag And Drop Files to a C# Application

Drag And Drop Files to a C# Application

June 11, 2009 | By | 8 Comments

The .NET Framework makes it easy to detect objects dragged and/or dropped into a Windows Forms application using one or more of the drag-and-drop events available. In these events you could check if the object is a file.

Continue Reading

Get the Available Network Connections Using WMI

Get the Available Network Connections Using WMI

March 30, 2009 | By | 6 Comments

Windows Management Instrumentation (WMI) makes querying Windows for system and devices information easy. And this is even easier with System.Management assembly. The code listed loads the names of the network connections in a ListBox, which when clicked displays all the available properties in a ListView.

Continue Reading

Simple Networking Tasks in C#

Simple Networking Tasks in C#

March 27, 2009 | By | 15 Comments

Developing applications in C# that access resource on the internet is easy. This post shows four useful functions: checking if the PC is connected to a network, domain name to IP address lookup, ping a host and download a file.

Continue Reading

A Registry Viewer in C#

A Registry Viewer in C#

March 24, 2009 | By | 8 Comments

The Registry is a database in Windows that is available for application developers to use for storing small amounts of data. It is mostly used to save application setting like the window size and database connection string. In this series of post I will demonstrate how to create a simple registry editor in C#.

Continue Reading

Displaying an XML File in a TreeView Control

Displaying an XML File in a TreeView Control

March 21, 2009 | By | 1 Comment

XML’s structure is hierarchical and therefore can be displayed in a TreeView control easily. The XMLTree program displays the elements of the XML file in a TreeView control and the attributes of the selected element in a ListView control.

Continue Reading

A Wrapper Class For hostip.info’s GeoLocation Service

A Wrapper Class For hostip.info’s GeoLocation Service

March 18, 2009 | By | 2 Comments

GeoLocation refers to identifying a real-world geographic location of a computer, device or website visitor. There are a many websites that provide this service, some are free and some are not. A populare and free one is hostip.info. It provides country, country code, country flag, city, latitude and longitude of an IP address.

Continue Reading