|
|
Marking strings with a different color in source code documents
|
Total Hit (2537) |
When you build strings by concatenating hardcoded constant strings and variable strings, it's easy to forget a closing double quote, and thus receive a compile time error when you launch or compile the program (actually, you see that there is a syntax error even before, because the statement gets un
....Read More |
Rating
|
|
|
|
Retrieving special system paths
|
Total Hit (2643) |
The GetFolderPath method of the Environment class lets you retrieve the path of several important system directories. For example, here's how you determine the path of the Desktop directory for the current user:
«Code LangId=2»
Console.WriteLine(Environment.GetFolderPath _
(Environment.Spec
....Read More |
Rating
|
|
|
ExplodeForm - Showing a form with an explosion effect
|
Total Hit (3986) |
«Code LangId=2»
' Show a form with an explosion effect.
' the numSteps parameter is the number of steps to increase the form size from
' 0 to the original size
' the stepDuration argument is the number of milliseconds between each step
' Example:
' Private Sub Form1_Activated(...) Handles
....Read More |
Rating
|
|
|
Debugging custom action in Visual Studio.net Setup project
|
Total Hit (3798) |
I had spent quite bit of time searching around and finally got something which gives you ability to debug custom action in visual studio setup project. Here is few steps to debug custom action code.
Generally you write a seperate DLL which includes custom action code. To learn more about how to w
....Read More |
Rating
|
|
|
|
|
|
Understanding passing arrays by reference
|
Total Hit (3562) |
.NET arrays are object types, thus an array variable is actually a pointer to the object where data is actually stored. For this reason, when you pass an array to a procedure the pointer is passed and the called procedure is always able to modify the elements of the array, regardless of whether the
....Read More |
Rating
|
|
|
Prevent a second process instance from running
|
Total Hit (2970) |
VB6 developers can use the App.PrevInstance property to check whether there is another instance of the same process already running on the current machine. This property isn't available any longer in VB.NET, so you must retrieve this information by using the properties of the Process object.
The
....Read More |
Rating
|
|
|
ImplodeForm - Hiding a form with an implosion effect
|
Total Hit (2831) |
«Code LangId=2»' Hiding a form with an implosion effect.
' the numSteps parameter is the number of steps to decrease the form size from
' the current size to 0
' the stepDuration argument is the number of milliseconds between each step
' Example:
' Private Sub Form1_Closing(...) Handles My
....Read More |
Rating
|
|
|
|
|
|
IsValidUsZip - Validating a US ZIP code
|
Total Hit (2798) |
«Code LangId=2»
' Validate a US ZIP code
' Example:
' MessageBox.Show(IsValidUsZip("12345")) ' => True
' MessageBox.Show(IsValidUsZip("12345-1234")) ' => True
' MessageBox.Show(IsValidUsZip("12345-12345")) ' => False
Function IsValidUsZip(ByVal zip As String) As Boolean
Re
....Read More |
Rating
|
|
|
IsImageFile - Returns whether the file is an image
|
Total Hit (3674) |
«Code LangId=2»
' Returns a boolean indicating whether the file is an image
Function IsImageFile(ByVal filePath As String) As Boolean
' add more extensions if you wish
Dim extensions() As String = New String() {".bmp", ".jpg", ".jpeg", ".gif", _
".tif", ".tiff", ".png", ".tga",
....Read More |
Rating
|
|
|
SaveTextFile - Save or append text to a file
|
Total Hit (3662) |
«Code LangId=2»
' Saves a text file. If the destination file already exists,
' its content can be replaced, or the new content can be appended
' at the end of the file, according to the last parameter
' Note: the destination directory must exist, otherwise the file is not
' saved and th
....Read More |
Rating
|
|
|
Implementing IClonable - Shallow copies
|
Total Hit (2536) |
An object that want to support cloning should implement the ICloneable interface. This interface exposes only one method, Clone, which returns a copy of the object. The ICloneable specifics don't specify whether the object that the Clone method returns is a shallow copy or a deep copy. The differenc
....Read More |
Rating
|
|
|
Ensuring that a style is supported by a font family
|
Total Hit (2604) |
«Code LangId=2»' Not all fonts support the same styles. This function takes in
' input a font family and a font style, and returns a font style
' which is safe for that particular font family, by removing
' the styles that are not supported
'
' Example:
' GetSafeStyleForFontFamily(richTextB
....Read More |
Rating
|
|
|
|
.NET Outlook Style ListBar Control
|
Total Hit (1811) |
The .NET ListBar control aims to provide the most accurate reproduction of the Microsoft Outlook bar control. All the features of the Outlook bar control are supported and more: in particular the control provides nicer drag-drop operation, has more display modes and provides an extensible object mod
....Read More |
Rating
|
|
|
|
|
|
|
|
SysTray from .NET
|
Total Hit (1687) |
The .NET Framework includes a NotifyIcon component but this unfortunately doesn't support InfoTip (balloon) notification; at least, not in v1.0 of the Framework. This sample provides an equivalent class which uses the Shell code directly to allow all the tooltip facilities to be used.
....Read More |
Rating
|
|
|
How Do I...Generate and compare a hash value?
|
Total Hit (2309) |
It is easy to generate and compare hash values using the cryptographic resources contained in the System.Security.Cryptography namespace. Because all hash functions take input of type Byte[], it might be necessary to convert the source into a byte array before it is hashed.
To generate a hash val
....Read More |
Rating
|
|
|
Display Multiple reports using single ReportViewer control
|
Total Hit (1114) |
It is easy to get the ReportViewer Control to report off of a DataSet that is set during design time. But what if you want to use code to cause one ReportViewer control to display many totally different reports using your own O/R mapper collection instead? It is not easy to see how to do this, but i
....Read More |
Rating
|
|