Welcome to WindowsClient.net | Sign in | Join

Articles

Sponsors





  • advertise here

October 2007 - Posts

.NET Tip: Compressing/Decompressing Your Files
One of the many new libraries included with .NET 2.0 allows for compression and decompression of files using the gzip file format. The major downside to this format is that it isn't compatible with the built-in Compressed Folders format built into Windows XP. However, I was able to open a compressed file with WinZip after I renamed the file with a ".Z" extension. WinZip still needed the original filename that I compressed, but once I provided that, it was able to decompress the file.
Clipboard Ring Application

The Windows Clipboard is used by many applications, such as word formatters and word processors, as a temporary repository for data. The most obvious examples are Cut, Copy, and Paste. the Clipboard is also useful for transferring data from one application to another because the Clipboard is common across applications (processes). When data is added to the Clipboard, the data format can be specified so that other applications can recognize the format and decide whether to process it.

Keyed Anonymous Types in VB9

Anonymous types use the Dim keyword but do not include a formal type—that you code—in the initialization statement. That is, the New keyword is used but there's no class name. These are not invariant types; these are strong types but the class is code-generated by the compiler and emitted to MSIL (the binary assembly) as an anonymous type.

Anonymous types are emitted using the same definition if the field names, number, and order are identical. Anonymous types are generated using generics so the field types can differ and still the same anonymous types will be used. If there are differences in the right-hand-side definition—for example, you use more or fewer fields, change the name—called the member declaratory—or add special qualifiers such as a key, the anonymous types will vary.

Visual Basic anonymous types are mutable—the field values can be changed—which is the opposite of C# anonymous types. C# anonymous types are immutable. However, you can use the Key keyword to designate certain fields in VB9 as fixed (or immutable), and that's what this article is about.

Posted: Oct 27 2007, 03:27 PM by jaytayl
Filed under:
Implementing a Decimal-to-Fraction Class with Operator Overloading

You don't see overloaded operators used that much in custom code. And, in few business applications have I seen a request for fractions, but there was such a request made of me recently. Following a search on the web. I discovered news groups and Q&A sites where some of you did request a Fraction's class. So, I thought I'd share a solution.

In this article, you will learn how to implement a Fraction's class—which is ideally suited for overloaded operators, how to overload operators in Visual Basic, and get a quick reminder from your college days on the Euclidean algorithm for calculating the greatest common divisor.

Structured Exception Handling in VB.NET

VB.NET improved a number of features compared to the legacy VB language. One of the most notable changes is the introduction of structured exception handling. Even though VB.NET still supports the On Error Goto type of error handling, it's not a good idea to use it. Instead, you should utilize the full power of the structured exception handling available in VB.NET.

This article will discuss the basics of structured error handling with VB.NET and look at examples of using exception handling in your applications.

Box Clever - WPF ListBox

In Visual Studio 2008, thanks to the introduction of Windows Presentation Foundation, the humble ListBox finally comes of age. In previous incarnations, if you wanted to do anything but the most basic tweak of the user interface of a ListBox you usually had to resort to using OwnerDraw techniques and your options were quite limited. WPF really lifts the lid off the ListBox. (Sorry - I just couldn't resist that one!).

Now you can create very complex ListBoxes with ListBoxItems that contain multiple combinations of elements and other controls. In fact, you don't even need to contain them in ListBoxItems; if you simply want a "list" of, for instance, a set of images then WPF is smart enough to know how to render these correctly for you. And the selection process works exactly as if you had the more usual list of strings, complete with all the SelectedIndex, IsSelected, etc information that you would expect.

Add to this the power of WPF Control Templates and time-saving WPF Styles and you really do have a tool set that can be reworked in ways that were unimaginable with Windows Forms ListBoxes.

WPF Layout - The WrapPanel

As its name implies, this kind of panel is designed to dynamically change the layout of its children by wrapping them horizontally or vertically as necessary in order to try to keep displaying them for as long as possible. Obviously, if you don't set minimum size values it will eventually become possible for the children to be cropped or finally disappear, but the WrapPanel does its best to display as much as it can.

This can be a very useful layout panel in WPF. In my limited experience I have found that it seems to work best when its children are of equal or similar dimensions to each other. This isn't a requirement; it simply seems to look better in this case.

As you may have seen in the earlier blog items on WPF layout panels, the UniformGrid and the DockPanel, it's very common to use layout panels as containers for other layout panels. Sometimes these will be the same kind of panel, e.g. a DockPanel within a DockPanel; sometimes not. I think that in the majority of situations you will want to use the WrapPanel as a sub-element inside another container.

WPF DataBinding, Styles and DataTemplates
In this article I would like to show how DataBinding in WPF can be used. Thereby a list of Person-objects is displayed by using DataTemplates and Styles in a WPF-Window. By studying this example one can understand how the separation of representation and data/logic can be realized with WPF.
Integration of WinForms in WPF-Applications
WPF is a new technology for implementing rich graphical user interfaces with .NET. It has a powerful engine based on DirectX which offers a lot of new possibilities to design your GUI. But what's about existing WinForms-applications? Is there a way to convert these to WPF? In this article is explained how to integrate WinForms into WPF-applications.
Vista Gadgets: Developer SearchBox
Create Sidebar Gadgets for Windows Vista — and end up with a convenient desktop gadget for finding software development answers on the web. Download it, discover how it works, and learn how to make your own sidebar gadgets.
Stitching Up Time Zones
My daughter George up from Texas this week with the grandkids, so I didn't get a lot of work done—but, that's how it should be. I was having a problem getting a reader registered on my book's support site when she looked over my shoulder. I was in the process of building a Reporting Services report against my Hitchhiker's Guide users' database which tracks registered readers so they can download the errata and premium content and ask questions. She asked if I could break down the data into regions so we could see where my readers live—she's an engineer/mom and thinks of things like that. I thought it was a good idea, so I dove into the problem while the kids were napping.
Introducing WPF 3.5
Nothing is more important than a user’s experience of an application. While many software professionals are more interested in how an application works, its users care deeply about its user interface. An application’s interface is a major part of the complete user experience with that software, and to many of its users, the experience is the application. Providing a better experience through a better interface can improve productivity, help create loyal customers, increase sales on a Web site, and more.
 
Once happy with purely character-based interfaces, users have now become accustomed to graphical interfaces. Yet the requirements for user interfaces continue to advance. Graphics and media have become more widely used, and the Web has conditioned a generation of people to expect easy interaction with software. The more time people spend interacting with applications, the more important the interfaces to those applications become. To keep up with increasing expectations, the technology used to create user interfaces must also advance.

The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. First included in version 3.0 of Microsoft’s .NET Framework, an enhanced version of the technology is now part of the .NET Framework 3.5. Using WPF, developers and designers can create interfaces that incorporate documents, media, two- and three-dimensional graphics, animations, and much more. Like everything else in the .NET Framework 3.5, WPF is available for Windows Vista, Windows XP, Windows Server 2003, and Windows Server 2008. This paper introduces WPF, describing its various parts. The intent is to make clear the problems this technology addresses, then survey the solutions that WPF provides.

Download the paper "Introducing WPF 3.5" here.

Posted: Oct 07 2007, 10:11 PM by jaytayl
Filed under:
BizTalk Pipeline Dreams Become Reality
In BizTalk Pipeline Dreams, Part I a prototype called the Pipeline Channel Stack is described. Using ideas garnered from WCF, a prototype was built to allow you to more easily build "one-offs" or extend BizTalk Custom Pipeline solutions.

The prototype classes are arranged like the figure below.

 

BizTalk Pipeline Dreams, Part I
I think I've been suffering from "configuration envy." Looking at products such as WCF and the easy way you can build much of a service with a simple XML file, one begins to wish some of the older Microsoft products worked the same way. Take, for example, the BizTalk 2006 Pipeline Component.
Data Binding an Enum with Descriptions

Every once in a while I need to bind an enumerated type to a Windows Forms control, usually a ComboBox. There are lots of articles here on The CodeProject that present various ways to do this, each with their own pros and cons. However, they are generally more complicated than necessary, and in some cases, require a lot of work on either the developer implementing the enum, the developer using it, or both.

Page view counter