|
Quickly swap assignment operands
|
Total Hit (2679) |
It often happens that you need to swap the operands of an assignment. For example, say that you have this set of assignments:
«Code LangId=2»
p1.FirstName = m_FirstName
p1.LastName = m_LastName
«/Code»
and later in your source code you want to add a similar set of assignments, but with rever
....Read More |
Rating
|
|
|
|
Support COM+ constructor strings in serviced components
|
Total Hit (2796) |
Having a VB6 component support a COM+ construction string requires that you implement the IObjectConstruct interface and its only method, Construct. The .NET ServicedComponent class implements this interface internally and expose the Construct method as a protected, overridable method. Thus your VB.
....Read More |
Rating
|
|
|
Creating owner drawn menu items to simulate a color picker
|
Total Hit (3625) |
«Code LangId=2»' This class does the owner drawing of a MenuItem to draw a color box.
' The class inherits from MenuItem, thus the ColorMenuItem objects
' can be added to a parent MenuItem or a context menu as you
' normally do, and can also be mixed with other MenuItem items
' under the same
....Read More |
Rating
|
|
|
|
|
IsExecutableFile - Returns whether the file is an executable
|
Total Hit (2670) |
«Code LangId=2»
' Returns a boolean indicating whether the file is an executable
Function IsExecutableFile(ByVal filePath As String) As Boolean
' add more extensions if you wish
Dim extensions() As String = New String() {".exe", ".bat", ".com", ".pif"}
' return true if the extension
....Read More |
Rating
|
|
|
|
Working with owned forms
|
Total Hit (3177) |
If a form owns another form, the owned form will be always displayed in front of its owner form, no matter which is the active form. This makes owned forms ideal for implementing tool and palette windows. Another feature of owned forms: when the user closes or minimizes the owner form, all the owned
....Read More |
Rating
|
|
|
Wait for a process to terminate
|
Total Hit (3391) |
You can use the VB.NET Shell command (in the Microsoft.VisualBasic namespace) to run an external process and wait for its termination, but you can get better control if you work directly with the Process class in the System.Diagnostics namespace. You can start a process with the Start static method
....Read More |
Rating
|
|
|
Creating an XML Document with the XMLTextWriter Class
|
Total Hit (2744) |
To quickly create a new XML document you can use the XMLTextWriter class. There are many ways to create XML in the .NET Framework, but the XMLTextWriter is one of the quickest.
«Code LangId=2»
Dim mywriter As System.Xml.XmlTextWriter
mywriter = New System.Xml.XmlTextWriter("c:\myxml.xml", Not
....Read More |
Rating
|
|
|
|
MDAC 2.6 is required for .NET applications
|
Total Hit (2667) |
All ADO.NET applications require MDAC 2.6 or later (MDAC 2.7 is recommended). MDAC 2.7 comes with Visual Studio .NET but no MDAC version is included in the Microsoft .NET Framework SDK and the .NET Framework redistributable package. If your .NET application attempts to open a connection without a va
....Read More |
Rating
|
|
|
|
Tutorial - Assembly
|
Total Hit (24278) |
«a name=#L1»«/a»
«big»What is Assembly?«/big»
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked e
....Read More |
Rating
|
|
|
|
Implementing ICloneable - Deep copies
|
Total Hit (3351) |
The simplest way to create a generic deep copy routine, that is a procedure that can create a true, distinct copy of an object and all its dependent object, is to rely on the serialization features of the .NET framework.
«Code LangId=2»
Function CloneObject(ByVal obj As Object) As Object
'
....Read More |
Rating
|
|
|
LoadTextFile - Load the contents of a text file
|
Total Hit (2799) |
«Code LangId=2»
' Returns the content of the specified text file
' Note: it can throw an exception
' Usage: Dim FileContent As String = LoadTextFile("C:\Autoexec.bat")
Function LoadTextFile(ByVal FilePath As String) As String
Dim sr As System.IO.StreamReader
Try
sr = New
....Read More |
Rating
|
|
|
How Do I...Get information about processes?
|
Total Hit (910) |
Please note that this sample might fail on Windows 95 or Windows 98 machines.
You can use the Process component to accomplish most process management tasks quickly and easily. You can use this component to work with processes on either local or remote computers. For example, you can query a proc
....Read More |
Rating
|
|
|
Getting Started with ObjectSpaces
|
Total Hit (2115) |
ObjectSpaces is one of the exciting features coming in the new version of .NET Framework, codename "Whidbey". This article will explain what ObjectSpaces are and will provide a step-by-step guide to a first experience with ObjectSpaces.
|
Rating
|
|
|
|
HotKeyForm
|
Total Hit (1847) |
One of the Windows API features which isn't included in the .NET Framework is setting up and receiving notifications from system-wide HotKeys. This article presents an extended version of System.Windows.Forms.Form which adds HotKey functionality.
|
Rating
|
|
|
The Power of Print
|
Total Hit (1129) |
Rocky Lhotka explores manual printing using Visual Basic .NET and the .NET Framework, and shows you how to manipulate this powerful and flexible model to generate virtually any type of output imaginable, including support for both printers and print preview displays.
....Read More |
Rating
|
|
|
Utilizing Regular Expression SubMatches
|
Total Hit (1609) |
This article examines advanced features of regular expressions. For more basic and beginner-level information on regular expressions, as well as a number of articles illustrating various applications of regular expressions, be sure to check out the articles at the Regular Expression Article Index!
....Read More |
Rating
|
|
|
How Do I...Read from a performance counter?
|
Total Hit (917) |
Windows performance counters enable your applications and components to publish, capture (read), and analyze the performance data that applications, services, and drivers provide. You can use this information to determine system bottlenecks and fine-tune system and application performance. For examp
....Read More |
Rating
|
|
|
How Do I...Read XML data from a stream?
|
Total Hit (991) |
This sample illustrates how to read XML from a stream using the XmlTextReader class. The stream could have come from a variety of sources such as a byte stream from a server, a file, or from a TextReader.
|
Rating
|
|
|
Inheritance and Interfaces : Sample Chapter from Professional VB.NET
|
Total Hit (1104) |
Inheritance is the idea that we can create a class that reuses methods, properties, events, and variables from another class. We can create a class with some basic functionality, then use that class as a base from which to create other, more detailed, classes. All these classes will have the same co
....Read More |
Rating
|
|
|
Typed DataSets in .NET by Ramaprasad Upadhyaya.
|
Total Hit (681) |
As all of we know, we can specify the data type when we create a DataColumn for a DataTable. This is to enforce the runtime type-safety for the column so that only data of specified data type can be stored in the column.
|
Rating
|
|
|
How Do I...Create a log file?
|
Total Hit (1228) |
This sample illustrates how to create a basic log file using the IO classes. This demonstration introduces many useful concepts such as writing to a file, and opening a file, even if the file does not yet exist. Since the information written to the file needs to be shown to the user, this example al
....Read More |
Rating
|
|
|
Writing Provider-Independent Data Access Code with ADO.NET 2.0
|
Total Hit (957) |
When you need to write an application that allows users to select the database provider, the application code itself needs to be completely provider-independent. ADO.NET 2.0 helps you create and deliver database applications even when you don't know what database your clients are using.
....Read More |
Rating
|
|