|
|
Duplicate the SET operating system command
|
Total Hit (2576) |
The Environment.GetEnvironmentVariables property returns the list of all the environment variables, as an IDictionary object. If you want to display them sorted by their name, as the SET command does at the prompt, you need the following tricky code:
«Code LangId=2»
' Get all the variables, as a
....Read More |
Rating
|
|
|
Disable .NET security
|
Total Hit (2043) |
The .NET Framework enforces secuity at several levels. For example, assemblies downloaded from the Internet have very limited permissions (especially after installing the Service Pack 1 of the Framework). This means that many operations that would be legal in some cases may throw an exception in oth
....Read More |
Rating
|
|
|
Adding styles to the font of the selected text of a RichTextBox
|
Total Hit (2095) |
«Code LangId=2»' Add a style to the selection of a RichTextBox,
' without deleting the current styles that may be already
' present in the selection or in portions of it
'
' Example: AddFontStyle(richTextBox1, FontStyle.Bold)
Public Sub AddFontStyle(ByVal rtb As RichTextBox, _
ByVal styl
....Read More |
Rating
|
|
|
Language features - Array
|
Total Hit (8729) |
Arrays allow you to refer to a series of variables by the same name and to use a number, called an index or subscript, to tell them apart. This helps you create shorter and simpler code in many situations, because you can set up loops that deal efficiently with any number of elements by using the in
....Read More |
Rating
|
|
|
|
Language features - Variables and types
|
Total Hit (2603) |
The Microsoft .NET Framework provides a robust system of primitive types to store and represent data in your application. Data primitives represent integer numbers, floating-point numbers, Boolean values, characters, and strings.
In VB.net you can declare variable using Dim statement as shown be
....Read More |
Rating
|
|
|
IsValidUsPhoneNumber - Validating a US phone number
|
Total Hit (2954) |
«Code LangId=2»
' Validate a US phone number
' Example:
' MessageBox.Show(IsValidUsPhoneNumber("(123) 456-7890")) ' True
' MessageBox.Show(IsValidUsPhoneNumber("(123) 456-78901")) ' False
Function IsValidUsPhoneNumber(ByVal phnNum As String) As Boolean
Return System.Text.RegularExp
....Read More |
Rating
|
|
|
Reduce COM+ context overhead: use modules and shared members
|
Total Hit (2718) |
If you use Shared members in .NET or modules in VB6, you reduce COM+ context overhead without any risk whatsoever that you will get extra context overhead for that code. You also release yourself from the clean-up burden that you have in both worlds. Instead of the VB6 consumer code:
«Code LangId
....Read More |
Rating
|
|
|
|
Evaluate an expression using the Microsoft Script Control
|
Total Hit (3511) |
Thanks to COM Interop, you can still use the Microsoft Script Control from VB.NET and any other .NET language. To do so, you must add a reference to the Microsoft Script Control library (from the COM page in the Add Reference dialog box): this action creates a new reference named Interop.MSScriptCon
....Read More |
Rating
|
|
|
Including/excluding files in Visual Studio .NET
|
Total Hit (2527) |
Say that that you have an existing Visual Studio .NET project, and that you copy a lot of new source code files, images and other stuff from another project (maybe you're merging two projects, or a colleague wrote and passed those files to you). One approach to include the new files is to use the Pr
....Read More |
Rating
|
|
|
|
|
|
Use VB6 ActiveX controls with VB.NET
|
Total Hit (4005) |
It is possible to use VB6 ActiveX controls - such as ADO Data Control, Chart Control, Comm Control, and the Windowless controls - with the designer of Visual Studio .NET, but you may encounter problems when doing so because VS.NET doesn't come with the design-time license for these controls, therefo
....Read More |
Rating
|
|
|
|
|
Display a directory tree
|
Total Hit (3953) |
Thanks to the GetDirectories and GetFiles methods of the System.IO.Directory class, you need very little code to iterate over all the directories and files of a directory tree. For example, the following code snippet prints the structure of a directory tree and (optionally) the name of files in each
....Read More |
Rating
|
|
|
|
Store bits and small integers efficiently in a BitVector32
|
Total Hit (3290) |
The System.Collections.Specialized.BitVector32 structure can be used to store up to 32 boolean values, or a set of small integers that can take up to 32 consecutive bits. The BitVector32 is similar to the BitArray class, in that it can hold boolean values that take only one bit each, yet it is more
....Read More |
Rating
|
|
|
Visual Basic .NET Internals
|
Total Hit (1212) |
The Microsoft .NET Framework has opened a new world for Visual Basic developers. Visual Basic .NET combines the power of the .NET Framework and the common language runtime with the productivity benefits that are the hallmark of Visual Basic. Although the Visual Basic .NET language looks the same on
....Read More |
Rating
|
|
|
|
Getting File Icons Using The Shell
|
Total Hit (1489) |
The .NET Framework doesn't provide much in the way for classes to interact with the Shell. This article provides a simple class which wraps the Shell's SHGetFileInfo to extract large and small icons plus the display name and file type for any file.
|
Rating
|
|
|
|
DataSets in Microsoft .NET - 2
|
Total Hit (1305) |
In the previous part of this article we discussed different features and how to create a dataset in design time lets go further in detail. In this part I will discuss about sort, search and filtering support provided by dataset and data table object.
|
Rating
|
|
|
Fun With DrawImage
|
Total Hit (1253) |
If you've ever tried to rotate an image in VB6, you know how tedious it can be. Sure, given plenty of time for trial and error, combined with some reasonably tricky mathematics and a little patience, you can figure out how to map pixels from the source image into the rotated destination image. Enter
....Read More |
Rating
|
|
|
How Do I...Pass Simple Data from .NET Code to VB6 code?
|
Total Hit (748) |
This example demonstrates how to use .NET objects from a Visual Basic 6.0 application. The same technique can be used to create the object from any COM application, including those built with Visual C++ 6.0, VBScript, or JScript.
|
Rating
|
|
|
How Do I...Create System Resources During Installation?
|
Total Hit (844) |
An application can consist not only of traditional program files, but also of associated resources such as message queues, event logs, and performance counters that must be created on the deployment destination. You can configure your application to create these resources when your application is in
....Read More |
Rating
|
|
|
Embedding MSDE SQL Engine in a Visual Studios .Net Setup application
|
Total Hit (1382) |
This document is a step by step description of adding SQL server to an Windows Application and embedding the MSDE engine into the application setup and installer program. By doing this you will automate the installation of the SQL server, the mounting of the datafiles and granting access to your app
....Read More |
Rating
|
|