|
Exception debugging in Visual Studio .NET
|
Total Hit (3193) |
The Visual Studio debugger offers complete control on what happens when an application throws an exception, or calls a .NET method that throws an exception. You set all the relevant options from inside the Exceptions dialog box, which you bring up with the Debug | Exceptions menu command. This dialo
....Read More |
Rating
|
|
|
IsValidEmail - Validate an email address
|
Total Hit (3595) |
«Code LangId=2»
Function IsValidEmail(ByVal Value As String, Optional ByVal MaxLength As _
Integer = 255, Optional ByVal IsRequired As Boolean = True) As Boolean
If Value Is Nothing OrElse Value.Length = 0 Then
' rule out the null string case
Return Not IsRequired
....Read More |
Rating
|
|
|
BinarySearch - Fast search in a sorted array
|
Total Hit (3454) |
«Code LangId=2»
' Binary search in an array of any type
' Returns the index of the matching item, or -1 if the search fails
'
' The arrays *must* be sorted, in ascending or descending
' order (the routines finds out the sort direction).
' LASTEL is the index of the last item to be searched, a
....Read More |
Rating
|
|
|
|
Create directory paths
|
Total Hit (3887) |
Visual Basic 6's MkDir command, as well as the DOS MD command, can create only one subdirectory and fail if any subdirectory on the specified path doesn't exist:
«Code LangId=2»
' This VB6 statement fails if C:\MyApp doesn't exist
MKDIR "c:\MyApp\MyDir"
«/Code»
Conversely, the Directory.Crea
....Read More |
Rating
|
|
|
|
Check whether Microsoft Word is installed
|
Total Hit (3144) |
The .NET frameworks provides a set of classes that let you work with the Registry, so it is quite easy to create routine that looks for specific keys to determine whether a program is installed or not. For example, the following code checks whether Microsoft Word is installed on the local computer:
....Read More |
Rating
|
|
|
|
Unload setup projects before running the Inheritance Picker
|
Total Hit (2906) |
If your solution contains a setup project and this setup project has been built at least once, you get an Assembly Load error when you run the Inheritance Picker in order to inherit from an existing form in your main project.
This problem occurs because the setup project generates several execut
....Read More |
Rating
|
|
|
|
Determine how many records the DataReader is about to return
|
Total Hit (3004) |
The DataReader is the ADO.NET counterpart of the forward-only, read-only recordset in classic ADO. For this reason you never know how many rows the DataReader is about to return. In most cases you don't need this information, because you tipically process each row as soon as it is being returned, an
....Read More |
Rating
|
|
|
|
|
Changing the project's output type
|
Total Hit (3291) |
When you start developing an application, the first thing you do in VS.NET is creating a new project and selecting its type: Windows Forms application, Class Library etc. However, it may happen that later in the development you want to change the project's output type. For example, you could have de
....Read More |
Rating
|
|
|
How to do Asynchronous Loading of Data Without Threading.
|
Total Hit (3813) |
Sometimes we need to work with long running task but still we dont want to stop responding other events in this type of situation mostly we will think about implementing threading. But here is more easy way without implementing threading.
Today we will discuss about IAsyncResult class found in Sy
....Read More |
Rating
|
|
|
|
|
Launch another process in a specified directory
|
Total Hit (2770) |
The System.Diagnostics.Process class provides several methods to launch and controls other Windows processes. For example, the following code sample shows how to run Notepad, pass arguments to it, and run it from inside a given intial directory:
«Code LangId=2»
' this code assumes that you have
....Read More |
Rating
|
|
|
Sending a File to a Web Server
|
Total Hit (3013) |
«B»Description«/B»
This is a working example of sending a file to a web server, and then processing the file from memory without saving it to a file.
«B»ASP Page Code«/B»
You will need to create a new Web Form and add this ASP.NET code to it.
«Code LangId=2»
<%@ Page Language="vb" Au
....Read More |
Rating
|
|
|
How to find all base classes of any type in .Net
|
Total Hit (3003) |
The following code shows how to print all base classes for a specified object.
«code LangId=2»Function PrintBaseClasses(ByVal obj As Object)
Dim t As System.Type
t = obj.GetType
Do While Not t Is Nothing
Debug.Write(t.Name)
t = t.BaseType
If Not t Is No
....Read More |
Rating
|
|
|
|
ADO.NET: Execute a Command
|
Total Hit (919) |
Commands are issued against databases to take actions against data stores. For example, you could execute a command that inserts or deletes data. For more information on moving data into and out of databases, see "Update a Database from a DataSet". Commands include any command that can be issued aga
....Read More |
Rating
|
|
|
How Do I...Write to an event log?
|
Total Hit (2494) |
Event logging provides a standard, centralized way for your applications to record important software and hardware events. Windows supplies a standard user interface for viewing the logs (the Event Viewer). Using the common language runtime's EventLog component, you can easily connect to existing ev
....Read More |
Rating
|
|
|
XML in the .NET Framework
|
Total Hit (1200) |
Extensible Markup Language (XML) is a meta-markup language that provides a format for describing structured data. XML enables a new generation of Web-based data viewing and manipulation applications. XML is the universal language for data on the Web. XML gives developers the power to deliver structu
....Read More |
Rating
|
|
|
Data Binding in Visual Basic .NET
|
Total Hit (1899) |
You might wonder why I didn't bind directly to the untyped DataSet. Well, the typed DataSet provides features such as early binding of fields. This enables you to use .CustomerName as a member of the DataSet instead of referencing the Items collection with the value "CustomerName," making the proces
....Read More |
Rating
|
|
|
Microsoft Beefs Up VBScript with Regular Expressions
|
Total Hit (1342) |
In this article, I'll describe all objects related to VBScript Regular Expressions, summarize common regular expression patterns, and provide some examples of using regular expressions in code.
|
Rating
|
|
|
System Image List
|
Total Hit (2573) |
Although you can easily extract copies of icons for any file from the Shell using the SHGetFileInfo call, if you need to be able to display the icon for a large number of files you can end up with too many icons and run out of resources. The System Image List uses an intelligent caching technique to
....Read More |
Rating
|
|
|
How Do I...List all the members of a type?
|
Total Hit (1166) |
This example lets you list the members for a given data type. The ability to list a type's members is a great way to quickly discover which elements are available. It is an important tool for reporting on your system as well as assisting in the development of user documentation. Using the Reflection
....Read More |
Rating
|
|
|
How Do I...Catch an Exception?
|
Total Hit (2174) |
This sample illustrates how to catch an exception. A try...catch...finally block is used in this sample. Any code that might throw an exception is placed inside of the try block. If an exception is thrown, the catch block is entered and the program can perform the appropriate operation to recover or
....Read More |
Rating
|
|
|