Jul 19
C# includes a number of pre-defined “built-in” data types. Each built-in data type is represented by a class in the System namespace that inherits from the base System.Object class. For example, an integer is represented by the System.Int32 class, and a string is represented by the System.String class.
C# defines an alias keyword for each built-in type. The alias keyword and its corresponding C# type are interchangeable. For example, you can define a string with the “string” keyword or “System.String” type:
Read the rest of this entry »
Jul 18
The .NET string class is quite comprehensive, yet some common string functions are missing or not entirely obvious. This article provides quick tips on using .NET strings.
Read the rest of this entry »
Jul 16
Did you know? You can type ASCII characters into any application. Press and hold the Left-Alt key, then using the numeric keypad, type the four-digit decimal number for the ASCII character you want, then release the Left-Alt key. For example, to type è, press and hold Left-Alt, then type 0232 on the numeric keypad. When you release the Left-Alt key, è will be typed.
Here is the world famous ASCII table:
Read the rest of this entry »
Jul 16
The Microsoft .NET Framework is quite comprehensive, but occasionally an obvious function slips through the cracks and you have to use InteropServices to access the Windows API.
One such obvious miss is the ability to truncate a file path. If you are drawing text and know the font and desired output size, you can use the WinForms TextRenderer class. But to truncate a file path to a specific number of characters, you need the “Shell Lightweight Utility Library” function PathCompactPathEx:
Read the rest of this entry »
Jul 11
The version of .NET against which you compile an application or assembly may not be the same version of .NET on which the application is currently running. A .NET application should always be able to run on the same or newer version of .NET against which it was compiled.
This is because .NET is backward compatible. This means that an application compiled on .NET v1.1 should run OK on .NET v2.0 and v3.0. But an application compiled on .NET v2.0 will not run on .NET v1.1.
Read the rest of this entry »
Jul 11
You can use the following JavaScript code in a web page to determine which versions of .NET are installed on a client PC:
Read the rest of this entry »
Jul 05
Changing a font style is a bit easier than changing its size, as there is a Font constructor that accepts a font and style as arguments. For example, to bold a label’s font:
Read the rest of this entry »
Jul 05
An inspection of the Font class will reveal that every public property is read-only. This means to change a font’s size, you need to create a new Font object with all the same properties of your current font but with the new size. Here is a handy method to do just that:
Read the rest of this entry »
Jun 29
When you show a .NET Form, by default the form will appear in the Windows Start bar and in the list of open windows shown when the user presses Alt+Tab.
Read the rest of this entry »
Jun 28
This multi-part article answers common questions about assemblies, the basic building blocks of .NET applications. This Part 4 covers shared assemblies and the Global Assembly Cache.
Read the rest of this entry »