|
|
|
Providing a default value for optional arguments
|
Total Hit (3274) |
Unlike VB6, VB.NET requires that you specify the default value of any Optional argument. In general you should use a value that is invalid under normal circumstances, so that the called procedure can discern whether the argument has been actually passed or not. For example, you should use -1 as a sp
....Read More |
Rating
|
|
|
Bin - Convert from decimal to binary
|
Total Hit (3746) |
«Code LangId=2»' convert from decimal to binary
' if you pass the Digits argument, the result is truncated to that number of
' digits
'
' you should always specify Digits if passing negative values
Function Bin(ByVal value As Long, Optional ByVal digits As Short = -1) As String
' conver
....Read More |
Rating
|
|
|
FormatMemorySize - Format a value in bytes
|
Total Hit (2764) |
«Code LangId=2»
Enum FormatMemorySizeUnits
BestGuess
Bytes
Kilobytes
Megabytes
Gigabytes
End Enum
' convert a number of bytes into Kbytes, Megabytes, or Gigabytes
Function FormatMemorySize(ByVal value As Long, _
ByVal unit As FormatMemorySizeUnits, Optional B
....Read More |
Rating
|
|
|
Process string faster with the StringBuilder class
|
Total Hit (2847) |
You can think of a StringBuilder object as a buffer that can contain a string with the ability to grow from zero characters to the buffer's current capacity. Until you exceed that capacity, the string is assembled in the buffer and no object is allocated or released. If the string becomes longer tha
....Read More |
Rating
|
|
|
CopyDirectory - Copy a directory
|
Total Hit (3036) |
«Code LangId=2»
' Copies a source directory to the destination directory.
' The last parameter specifies whether the files already present in the
' destination directory will be overwritten
' - Note: requires Imports System.IO
' - Usage: CopyDirectory("C:\Misc", "D:\MiscBackup")
Sub CopyDire
....Read More |
Rating
|
|
|
A cheap way to display files and hex data
|
Total Hit (4363) |
The .NET framework includes a ByteViewer control, that you can use on your own forms to display data stored in a Byte array or in a file. The ByteViewer control can't be added to the control Toolbox, though, so you must instantiate it through code only.
«Code LangId=2»
' IMPORTANT: this code re
....Read More |
Rating
|
|
|
|
|
Quickly swap assignment operands
|
Total Hit (2681) |
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
|
|
|
|
|
|
Wait for a process to terminate
|
Total Hit (3392) |
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 (2747) |
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
|
|
|
Tutorial - Assembly
|
Total Hit (24285) |
«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
|
|
|
How Do I...Get information about processes?
|
Total Hit (912) |
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
|
|
|
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
|
|
|
Inheritance and Interfaces : Sample Chapter from Professional VB.NET
|
Total Hit (1107) |
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 (1229) |
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
|
|
|
|
Sophisticated Drag-Drop Images
|
Total Hit (2127) |
The standard .NET Framework drag-drop functionality provides a cursor to indicate that a drag-drop function is in progress. This article demonstrates how to add an image of the object being dragged to the drag-drop control, in the same way that Explorer does using the ImageList APIs.
....Read More |
Rating
|
|
|
Consuming a Web Service from a Win Form Application
|
Total Hit (893) |
I guess you might be having some information on what Web Services. If not you can read .net101's article about Web Service Part 1 -Basics. In the current article we will be concentrating on building and consuming a Web Service which delivers "Stock Quotes" on the .NET Platform. We will be using Yaho
....Read More |
Rating
|
|
|
Walkthrough: Creating a Table in Word
|
Total Hit (1014) |
Programmatically creating a table in Word is simple, once you know the tricks. Using the provided styles, you can quickly lay out an attractive table.
|
Rating
|
|