|
IsValidUsSSN - Validating a US Social Security Number (SSN)
|
Total Hit (3927) |
«Code LangId=2»
' Validate a US Social Security Number
' Example:
' MessageBox.Show(IsValidUsSSN("123-12-1234")) ' True
' MessageBox.Show(IsValidUsSSN("123-123-1234")) ' False
Function IsValidUsSSN(ByVal ssn As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(
....Read More |
Rating
|
|
|
|
|
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
|
|
|
|
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
|
|
|
Creating multiline tooltips
|
Total Hit (3350) |
In VB6 there was no easy way to create multiline tooltips for form controls, you necessarily had to resort to API tricks. And it was probably just not worth the effort. The good news is that doing this is straightforward in VB.NET! First add a Tooltip Provider control on the form to add the Tooltip
....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
|
|
|
FilterDuplicates - Delete duplicate items in an array
|
Total Hit (3195) |
«Code LangId=2»
' Filter out duplicate values in an array and compact
' the array by moving items to "fill the gaps".
' Returns the number of duplicate values
'
' The array is not REDIMed, but you can do it easily using
' the following code:
' a() is a string array
' dups = FilterDu
....Read More |
Rating
|
|
|
Drawing Cardinal splines
|
Total Hit (4339) |
GDI+ supports two different forms of a complex curve that can't be represented as an arc of a circle or an ellipse: a cardinal spline and a Bézier spline. A cardinal spline is the curve that you would create by taking a piece of flexible material-such as a thin stripe of iron or wood-and making it p
....Read More |
Rating
|
|
|
|
|
Hiding pages of a TabControl
|
Total Hit (2782) |
Sometimes you may need to hide or show some pages of a TabControl according to the information you want to show, basing on the currently logged-in user for example (users with low privileges won't be able to get all the information or to change records). To do this, you may attempt to add or remove
....Read More |
Rating
|
|
|
Determine the Windows version
|
Total Hit (3104) |
You don't need to call any Windows API function in VB.NET to determine which version of Windows your application is running on, because this information is exposed by the Environment.OSVersion property. For example, if you run this code under Windows 2000:
«Code LangId=2»
Console.WriteLine(Envir
....Read More |
Rating
|
|
|
Walkthrough: Creating a Table in Word
|
Total Hit (1015) |
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
|
|
|
|
|
How Do I...Format basic types?
|
Total Hit (2466) |
This sample illustrates how to format base data types for display. Traditionally, formatting the user can see, such as brackets and the dash in a phone number, has not been viewed as the kind of information you want to store in a permanent datastore. The formatting provided in these demonstrations e
....Read More |
Rating
|
|
|
Calling .Net Classes from Visual Basic 6
|
Total Hit (999) |
Despite all the power and features of Visual Studio.Net, lots of developers are sticking with good old Visual Basic 6 for at least some of their development projects. There's good reason for this. Tens of thousands of developers know VB6 from the inside out, and can create applications quickly and e
....Read More |
Rating
|
|
|
|
Sophisticated Drag-Drop Images
|
Total Hit (2128) |
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
|
|
|
Building Objects : Sample Chapter from Beginning Visual Basic .NET
|
Total Hit (1170) |
In the time you've been using computers, you may well have heard the term, object-oriented. You may also have heard that it's a scary subject and tricky to understand. Whilst this was true about ten or fifteen years ago, today, object-orientation (or OO) is a wonderfully easy-to-understand concept t
....Read More |
Rating
|
|
|
How Do I...Change the search path for private assemblies?
|
Total Hit (1760) |
Private assemblies are assemblies that are visible to only one application. The .NET Framework enables developers to build applications that are isolated from changes made to the system by other applications. Private assemblies must be deployed in the directory structure of the containing applicatio
....Read More |
Rating
|
|
|
How Do I...Infer DataSet mappings from XML?
|
Total Hit (938) |
This sample illustrates how to create DataSet mappings from XML Data. This sample uses the concept of inference, whereby the actual structure of the XML data itself is the basis for a relational schema. The sample then creates a relational structure of tables and columns to store data in a DataSet t
....Read More |
Rating
|
|