|
|
Exclude code portions with the Conditional attribute
|
Total Hit (3227) |
VB developers have always used the #IF compiler directive to include or esclude portions of code from the application. The problem with this directive is that you can easily exclude a procedure with a single directive, but it isn't easy to discard all the calls to that procedure (which would raise a
....Read More |
Rating
|
|
|
Take advantage of the new math functions
|
Total Hit (2986) |
The System.Math class exposes several static methods that let you perform many common operations. These functions replace the VB6 functions with same name, but there are a few new functions that have no direct VB6 counterpart:
Ceiling(x) returns the integer equal or higher than the argument
Floo
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
|
Linking a file in Visual Studio .NET
|
Total Hit (2629) |
If in VS.NET you add to the current project an existing file that's located outside the current project's directory, the file is first copied in the project's directory, and then it's added to the project. However, you may want to share the same source file among multiple projects, so that if you mo
....Read More |
Rating
|
|
|
Age - Evaluating the age of a person, given his/her birth date
|
Total Hit (2078) |
«Code LangId=2»' Evaluate the age of a person, given his/her birth date
' Example: Debug.WriteLine(Age(#9/28/1980#)) ' => 22
Function Age(ByVal birthDate As Date, Optional ByVal currentDate As Date = #1/1/ _
1900#, Optional ByVal exactAge As Boolean = True) As Integer
If currentDate
....Read More |
Rating
|
|
|
|
Drag and Drop files/folders from explorer and display in listbox
|
Total Hit (4116) |
This code will show you how simple it is to get file/folder list dragged from explorer.
«b»Step-By-Step Example«/b»
- Create a Windows Application
- Add one ListBox control on the form
- Add the following code in form1
- Run the project and try to drag and drop some files into listbox from
....Read More |
Rating
|
|
|
Store large Boolean arrays in a BitArray object
|
Total Hit (5842) |
.NET Boolean values require 4 bytes each, as opposed to the 2 byte taken under previous VB versions. When creating very large Boolean arrays this extra memory impacts negatively on the application's performance. The .NET Framework offers a specialized class, the System.Collection.BitArray class, whi
....Read More |
Rating
|
|
|
How Do I...Sink Unmanaged Events from .NET?
|
Total Hit (870) |
This example demonstrates how to sink unmanaged events from .NET code.
In order to use the types defined within a COM library from managed code, you have to obtain an assembly containing definitions of the COM types. Refer to the How Do I...Build a .NET Client That Uses a COM Server? for specific
....Read More |
Rating
|
|
|
ADO.NET: Work with Relational Data
|
Total Hit (575) |
A DataSet can contain either unrelated tables or related tables. You can think of a DataSet as a document of data. In fact, an XML data document is like this, except it is based on a hierarchical paradigm. Because data is often stored in relational databases, the DataSet can handle both hierarchical
....Read More |
Rating
|
|
|
|
Auto-File and URL Completion for Text Boxes and Combo Boxes
|
Total Hit (1606) |
Version 5 of the Shell, shipped with Windows 2000 and ME or above, provides the ability to add Auto-Complete to any Text Box. This sample provides two simple extensions to the TextBox and ComboBox classes to add AutoComplete to your application.
|
Rating
|
|
|
Leverage Regular Expressions
|
Total Hit (1977) |
Regular expressions provide a simple and efficient way—far beyond the capabilities most conventional programming languages offer—to search and replace text. However, relatively few developers are familiar with this powerful tool. I'll explain how you can leverage regular expressions from VB.NET to s
....Read More |
Rating
|
|
|
How Do I...Encrypt and Decrypt a file?
|
Total Hit (2712) |
The CryptoStream class in the System.Security.Cryptography namespace is used to easily define cryptographic transforms on any data stream. The constructor is defined as the following: CryptoStream (Stream argument, ICryptoTransform transform, CryptoStreamMode mode).
....Read More |
Rating
|
|
|
How Do I...Monitor an event log?
|
Total Hit (2295) |
Event logging provides a standard, centralized way for you to have your applications record important software and hardware events. Windows supplies a standard user interface for viewing the logs (Event Log). Using the common language runtime's EventLog component, you can easily connect to existing
....Read More |
Rating
|
|
|
|
XML Web Services (RPC the Easy Way)
|
Total Hit (2183) |
This sample chapter covers following things
«LI»The Role of XML Web Services in a Distributed System
«LI».NET Remoting vs. XML Web Services
«LI»XML Web Service Plumbing
«LI»The Role of IIS
«LI»Creating a Virtual Directory
«LI»The XML Web Service File Format
«LI»Creating an XML Web Service
....Read More |
Rating
|
|
|
|
DataSets in Microsoft .NET - 1
|
Total Hit (1776) |
ADO.NET was designed to meet the needs of this new programming model: disconnected data architecture, tight integration with XML, common data representation with the ability to combine data from multiple and varied data sources, and optimized facilities for interacting with a database, all native to
....Read More |
Rating
|
|
|
|
Safe, Simple Multithreading in Windows Forms, Part 2
|
Total Hit (1075) |
Explores how to leverage multiple threads to split the user interface (UI) from a long-running operation while communicating further user input to the worker thread to adjust its behavior, thus allowing a message-passing scheme for robust, correct multithreaded processing.
....Read More |
Rating
|
|
|