 |
Reduce COM+ context overhead: activate in the caller's context
|
Total Hit (2888) |
Even though you may want to use some COM+ services, it doesn't mean that you have to have a unique context for each and every instance. The root instance, that is, the instance that the client uses, must have a context, but the secondary instances can often co-locate within the first context.
In
....Read More |
Rating
 |
|
 |
Exception debugging in Visual Studio .NET
|
Total Hit (3297) |
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 (3723) |
«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 (3580) |
«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
 |
|
|
 |
Convert DataReader to DataTable
|
Total Hit (4012) |
There is no direct way to convert dataraeader to datatable in ADO.net so I wrote this function which is really handy.
Happy Prpgramming...
|
Rating
 |
|
 |
Create directory paths
|
Total Hit (4018) |
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
 |
|
|
 |
Determine the size of a structure
|
Total Hit (5137) |
Unlike previous Visual Basic versions, under VB.NET you can't use the Len function to calculate the length of a Structure or a class. However, it is easy to get this information with the SizeOf static method of the System.Runtime.InteropServices.Mashal class, as in:
....Read More |
Rating
 |
|
 |
Check whether Microsoft Word is installed
|
Total Hit (3258) |
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
 |
|
 |
Convert a decimal value to binary, octal, or hexadecimal
|
Total Hit (6268) |
The ToString method of the Convert class lets you easily and quickly convert a decimal value into a string representation of that number to binary, octal, or hexadecimal base:
«Code LangId=2»' convert to binary
Console.WriteLine(Convert.ToString(11, 2)) ' => 1011
' convert to octal
Console.W
....Read More |
Rating
 |
|
|
|
 |
EncodeBase64 - Encoding a string to base64
|
Total Hit (3346) |
«Code LangId=2»' Returns the input string encoded to base64
Private Function EncodeBase64(ByVal input As String) As String
Dim strBytes() As Byte = System.Text.Encoding.UTF8.GetBytes(input)
Return System.Convert.ToBase64String(strBytes)
End Function
«/Code»
....Read More |
Rating
 |
|
 |
AddBackslash - Append a backslash to a path if needed
|
Total Hit (4299) |
«Code LangId=2»
' Append a backslash (or any character) at the end of a path
' if it isn't there already
Function AddBackslash(ByVal Path As String, Optional ByVal ch As Char = "\"c) _
As String
If Not Path.EndsWith(ch) Then
AddBackslash = Path & ch
Else
AddBack
....Read More |
Rating
 |
|
 |
How to do Asynchronous Loading of Data Without Threading.
|
Total Hit (3932) |
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
 |
|
|
 |
Faster string comparison with the Is operator
|
Total Hit (3463) |
.NET strings are objects, so what you store in a String variable is actually a reference to a String object allocated in the managed heap. Even though the VB.NET compiler attempts to hide the object nature of strings as much as it can - for example, you don't need to declare a String object with a N
....Read More |
Rating
 |
|
 |
Changing the project's output type
|
Total Hit (3451) |
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
 |
|
|
 |
Unload setup projects before running the Inheritance Picker
|
Total Hit (3003) |
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
 |
|
 |
How To: Host a Remote Object in a Windows Service
|
Total Hit (1454) |
Objects called using the .NET Remoting infrastructure can be hosted by ASP.NET, custom executables or Windows services. This How To shows you how to host a remote object in a Windows service and call it from an ASP.NET Web application.
|
Rating
 |
|
 |
Creating Custom SOAP Extensions - Compression Extension
|
Total Hit (2410) |
Web Services have already been standardized and its usage if definitely on the rise. Developers are quickly finding new and better ways to apply Web Services in their existing or new application designs. Reviewing many of the Web Services designs I have noticed that developers are increasingly perfo
....Read More |
Rating
 |
|
 |
Data Binding in Visual Basic .NET
|
Total Hit (2012) |
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
 |
|
 |
ConsoleAttributes
|
Total Hit (2014) |
The ConsoleAttributes allows you to change the default behaviour of the console class. You can modify several attributes (like ForeColor, BackColor, Echo Input etc), and you can move the cursor around.
|
Rating
 |
|
 |
XML in the .NET Framework
|
Total Hit (1292) |
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
 |
|
 |
Life Without Control Arrays in Visual Basic .NET
|
Total Hit (1393) |
Control arrays were the best way to manage the controls on your Visual Basic forms, but there are no control arrays in Visual Basic .NET. Deborah Kurata describes how to use new Visual Basic .NET features to obtain control array functionality without the need for a control array.
....Read More |
Rating
 |
|
|
 |
How Do I...Catch an Exception?
|
Total Hit (2279) |
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
 |
|
|