Deborah's Developer MindScape

         Tips and Techniques for Web and .NET developers.

Archive for July, 2009

July 22, 2009

Converting Text to Proper Case

Filed under: C#,VB.NET @ 12:19 pm

When displaying text to the user as a title or message, you may want to ensure that the text is presented in proper case (also called title case). If you are not familiar with the term “title case”, it basically means upper casing the first letter of each word as you would do in a […]

July 21, 2009

Populating a TreeView Control from XML

Filed under: C#,VB.NET,WinForms,XML @ 4:58 pm

This post describes how to populate a WinForms TreeView control from an XML file assuming you are targeting the .NET Framework Version 3.5. The XML file used in this example looks like this: <States>   <State name="California">     <Regions>       <Region name="San Luis Obispo">         <Area name="Santa Maria" />         <Area name="Seaside" />       </Region> […]

Formatting Text Files

Filed under: C#,Text Files,VB.NET @ 3:16 pm

There are often times that you need to write out text files containing data managed by your application. For example, you may need to write out a file to be read by another system. In many cases, this file needs to have a particular format, with justified or aligned columns like this: 000001  Baggins             Bilbo     […]

Building a Business Object Base Class

Filed under: C#,Data Binding,OOP,VB.NET @ 1:49 pm

If you are building applications in .NET to manage data for a business, you are most likely creating business object classes. Depending on the business, these classes could include Customer, Product, Order, Invoice, PurchaseOrder, Employee, TimeCard and so on. A simple sample Customer class is shown here. There are some features that all business objects […]

July 16, 2009

Validation Class

Filed under: C#,OOP,VB.NET @ 6:15 pm

A common requirement in most applications is to validate the data entered by the user. This is such a common requirement, that it makes sense to build a reusable Validation class. This post details the beginnings of a .NET Validation class. The class was originally designed to validate business object properties. But it could also […]

July 14, 2009

Debugging: Heisenbug

Filed under: C#,Debugging,VB.NET @ 5:32 pm

Being a physics major in college, I am familiar with the Heisenberg Uncertainty Principle which basically states that in quantum physics, some properties (like position and momentum) cannot both be known to any precision. Though not technically accurate, the Heisenberg Uncertainty Principle is often simplified to what is called the observer effect. This refers to […]

Dates: Binding to Day Numbers

Filed under: C#,Data Binding,VB.NET,WinForms @ 4:07 pm

My prior post demonstrated how to bind to a list of month names. Once the user picks the desired month, you may want to provide a list of valid dates to pick a date in that month. For example: 1-30 for September and 1-31 for July. You can accomplish this using a switch statement (Select […]

Dates: Binding to Month Names

Visual Studio comes with DateTimePicker and MonthCalendar controls that provide a standard looking calendar for the user to pick a date. But there are times when these controls don’t provide the features you need. For example, say you want to ask the user for the month and year that their credit card expires. Or you […]

July 10, 2009

Enum: Binding to the Description Attribute

Filed under: C#,Data Binding,VB.NET,WinForms @ 6:31 pm

The Enum keyword allows you to define a standard set of named constants for use in your application. Sometimes you may want to present this same list of  values to your user. You can display the set of Enum values in a ComboBox or ListBox using data binding. And even better, if you use the […]

Populating a Business Object from a DataTable

Filed under: C#,Data,OOP,VB.NET @ 3:43 pm

Most business applications have business objects such as customer, order, or invoice. Often, the data access layer (DAL) provides the data and your code needs to use that data to manually populate a business object. This post describes how to manually populate a business object from a DataTable. It uses the Customer class defined here. […]

« Previous PageNext Page »

© 2020 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs