|
Use the Err.GetException method to create custom exceptions
|
Total Hit (2924) |
The Visual Basic .NET Err.Raise method and the Throw command are (partially) compatible. For example, you can use a Try...End Try block to catch an error raised with the Err.Raise method, and you can use an On Error Resume Next and the Err object to neutralize and inspect an exception object created
....Read More |
Rating
|
|
|
Extract null-delimited strings
|
Total Hit (3625) |
Most API function that return a string require that you pass a buffer where they can place the result as a null-terminated ANSI string (a.k.a. ASCIIZ string). The calling code must then extract the string by taking all the characters up to the first Chr$(0) character, if there is one. For example, t
....Read More |
Rating
|
|
|
ChangeFileExtension - Modify the extension in a file name
|
Total Hit (2922) |
«Code LangId=2»
' Change the extension of a file name
' if the last argument is True, it adds the extension even if the file doesn't
' have one
Function ChangeFileExtension(ByVal FileName As String, _
ByVal Extension As String, Optional ByVal AddIfMissing As Boolean = False) _
As St
....Read More |
Rating
|
|
|
Change the application priority
|
Total Hit (2917) |
The application's priority - and more in general the thread's priority - indicates how the application is "important" for the CPU. The more the priority is hight the more the CPU will dedicate his time to execute it.
In .NET the priority of a thread is indicated to the Thread.Priority property. B
....Read More |
Rating
|
|
|
|
|
Create all the subdirectories for a new folder
|
Total Hit (3768) |
The System.IO.Directory class exposes a CreateDirectory method that, as its name suggests, can create a subdirectory. However, this method is even more powerful than it appears at a first glance, in that it can even create all the intermediate subdirectories, if necessary. In other words, the follow
....Read More |
Rating
|
|
|
MK? And CV? - Convert numbers to strings and back
|
Total Hit (9706) |
The following routines convert a numeric value into a string that represents the number, and vice versa. They are useful for reading data written by QuickBasic programs, because the QuickBasic language functions that did the conversions were not ported to Visual Basic.
Points to note:
1. These
....Read More |
Rating
|
|
|
Create a gradient background
|
Total Hit (4563) |
a gradient brush is a brush that contains all the color nuances that vary from a starting color to an ending color, like the typical background screen of many installation procedures or Microsoft PowerPoint slides. The simplest way to create a linear gradient brush is passing its size (by means of a
....Read More |
Rating
|
|
|
|
|
Faster string comparisons with CompareOrdinal
|
Total Hit (3646) |
You can compare strings in many ways under VB.NET: by using the = operator (or another comparison operator), with the Equals method (which the String class inherits from System.Object), or with the Compare shared method. The Compare method is especially useful because it returns an integer that tell
....Read More |
Rating
|
|
|
|
Bind a DataGrid to a DataSet at design-time
|
Total Hit (3284) |
Binding a DataGrid - or any other data-aware control - to a DataSet or a DataTable at runtime isn't difficult: you just have to assign the DataTable to the DataGrid's DataSource property, as in:
«Code LangId=2»
' DS is the DataSet variable
DataGrid1.DataSource = ds.Tables("Titles")
«/Code»
....Read More |
Rating
|
|
|
|
GetDirectorySize - Calculate the size of a directory
|
Total Hit (2779) |
«Code LangId=2»
' Returns the size of the specified directory
' - Note: requires Imports System.IO
' - Usage: Dim DirSize As Long = GetDirectorySize("D:\Projects")
Function GetDirectorySize(ByVal DirPath As String) As Long
Dim DirSize As Long
Dim Dir As DirectoryInfo = New DirectoryInfo(
....Read More |
Rating
|
|
|
Tutorial - Getting familiar with Visual Studio.net IDE
|
Total Hit (12490) |
In this article we will look at the new exciting features of Visual Studio.net 2003 IDE.
«a name=#L1»«/a»
«big»Main window«/big»
Visual Studio.net IDE provides several layout options to provide simulated environment from previous versions. You can select different profile for keyboard or window
....Read More |
Rating
|
|
|
Showing and enumerating MDI child forms
|
Total Hit (3175) |
An MDI child form is a regular form whose MdiParent property points to its MDI container form, so the code that creates and displays a child window is very simple:
«Code LangId=2»
Sub ShowMdiChildWindow()
' Display the MenuForm form as a child of this form.
Dim frm As New MenuForm()
....Read More |
Rating
|
|
|
|
|
.NET Overview - sample chapter from Introducing .NET
|
Total Hit (1296) |
This first chapter will summarize many of the most important aspects of .NET. We'll start by looking at some of the serious drawbacks of current software development that prompted Microsoft to rethink their entire development structure. Then we'll progress to an overview of the overall vision and th
....Read More |
Rating
|
|
|
Reusing The ComboBox DropDown
|
Total Hit (1044) |
Normally, the combo box drop-down portion only appears underneath the combo box part of a control. However, using an age-old Windows hack you can get at the handle of the drop-down List and move it to any position you like on screen. This article provides a reusable class for manipulating the drop-d
....Read More |
Rating
|
|
|
|
Component Services for .NET, Part I of IV
|
Total Hit (2183) |
The topic of component services is about creating enterprise applications that need to be secure, reliable, available, efficient and scalable. Component Services, aka COM+ (previously MTS), is the part of the Windows Server OS that supports these goals. The idea is that integrating your application
....Read More |
Rating
|
|
|
Multicast Sockets
|
Total Hit (3890) |
In this chapter, we will create two Windows applications using multicasting features. With one application it will be possible to chat with multiple systems, where everyone is both a sender and a receiver. The second application – in the form of a picture show – demonstrates how large data packets c
....Read More |
Rating
|
|
|
|
Adding Mouse Gesture Support to .NET Windows Applications
|
Total Hit (1963) |
Use of mouse gestures to control application is becoming increasingly common in the more sophisticated web browsers. This sample demonstrates how you can support a range of mouse gestures in .NET Windows Forms Applications by implementing an IMessageFilter. VB.NET and C# code provided.
....Read More |
Rating
|
|
|
How Do I...Pass An Object to a Server By Reference?
|
Total Hit (731) |
This example demonstrates how to create an object that derives from MarshalByRefObject on the client that is then passed as a parameter to the server. The server calls a method on the remote object it receives. The first step is to create the object you need to pass.
....Read More |
Rating
|
|
|
Creating a Windows Service using VB.NET Part-I
|
Total Hit (622) |
Microsoft introduced long running background application called Services along with Windows NT Operating System. These services are multithreaded. Writing a windows NT Service using VB 6 was a tedious job. However, VB.NET masks the task much easy. In this article I will show you how to create a simp
....Read More |
Rating
|
|
|