|
|
A macro to protect a code section with a Try...Catch block
|
Total Hit (2984) |
When you're working with the Visual Studio .NET code editor, typing a Try keyword plus the Enter key automatically creates the End Try statement. The following simple macro does something more interesting: it lets you select a portion of code and protect it with a Try...Catch...Finally...End Try blo
....Read More |
Rating
|
|
|
Ask a Yes/no question and return a Boolean
|
Total Hit (2823) |
«Code LangId=2»
' Ask a Yes/no question
' returns True if the user replies "Yes"
' Example: MessageBox.Show(AskYesOrNo("Do you like me?", "ME", True))
Function AskYesOrNo(ByVal text As String, ByVal title As String, _
ByVal defaultAnswer As Boolean) As Boolean
Dim defButton As Messa
....Read More |
Rating
|
|
|
|
|
|
|
Mouse clipping with the Cursor class
|
Total Hit (2147) |
The Clip property of the System.Windows.Forms.Cursor class represents the rectangle within which the mouse cursor is confined, or Nothing if the mouse can move over the entire screen. This rectangle is in screen coordinates, so you must do some conversions if you want to confine the mouse to an obje
....Read More |
Rating
|
|
|
|
Determine whether a string is uppercase
|
Total Hit (3058) |
Here's a quick-and-dirty method to determine whether a string contains only uppercase characters
«Code LangId=2»
' the string to test is in the SOURCE variable
If System.Text.RegularExpressions.Regex.IsMatch(source, "^[A-Z]+$") Then
Console.WriteLine("Uppercase string")
End If
«/Code»
....Read More |
Rating
|
|
|
|
Language features - String
|
Total Hit (4550) |
String is a powerful datatype which you use everyday. VB.net gives you great functionality with String class. In this article we will see some common functions of string class and will also learn about StringBuilder class for very fast string operations.
<big>Facts about String class</big>
<b>
....Read More |
Rating
|
|
|
A better way to query for a single node
|
Total Hit (2510) |
In the XmlNode class, that is the class that provides node functionality in an XMLDOM representation of an XML document, the SelectNodes (and the ancillary SelectSingleNode) method exploits the XPath query language to let you extract nodes based on logical conditions. The SelectNodes methods return
....Read More |
Rating
|
|
|
|
Working with DateTime and TimeSpan Object in VB.net
|
Total Hit (34696) |
In this article we will explore some key language features which are frequently used by VB programmers.
«big»DateTimes in VB.net«/big»
VB.net provides many new features for DateTime datatype. Unlike VB6 in VB.net you can initialize DateTime variable with verity of initial values. In VB.net you
....Read More |
Rating
|
|
|
|
|
|
Flat VS.NET Style Menus - Even on Windows 98
|
Total Hit (2593) |
First and foremost, this component provides a menu style that is 90% identical to the one provided by VS.NET (the 10% gap is described below in the "Work pending" section, please help me eliminate it). This means that it applies the VS.NET menu style to not only individual menu items but also to the
....Read More |
Rating
|
|
|
|
ADO.NET: Connection Pooling
|
Total Hit (569) |
This sample illustrates how to construct a pool of connections to a datasource. You will want to do this to deploy high-performance applications. In this example the pool is established in the connection string and managed automatically by the SqlConnection.
....Read More |
Rating
|
|
|
How Do I...Execute Custom Code During Installation?
|
Total Hit (885) |
An application can consist not only of the traditional program files, but also of associated resources such as message queues, event logs, and performance counters that must be created on the deployment destination. You can configure your application to create these resources when the application is
....Read More |
Rating
|
|
|
|
Use .NET Forms as Popup Windows
|
Total Hit (2266) |
This article provides a reusable class which you can use to convert a form into a popup which works in the same way as the drop-down portion of a ListBox or the popup controls for picking colours or tables in Office. In addition to wrapping all the functionality you need to ensure the popup is cance
....Read More |
Rating
|
|
|
A .NET Implementation of the ZoomIn Utility
|
Total Hit (2182) |
The ZoomIn Utility enables you to look at any area of the screen and capture the display. This can be an excellent way to snip graphics from other applications or to work out the exact details of how other controls are drawn. A copy of this is provided along with Visual Studio as a tool and also as
....Read More |
Rating
|
|
|
Validate What? Using Regular Expressions to Validate Input
|
Total Hit (1730) |
Validating user input is a basic but very necessary part of web development, especially when dealing with databases. Queries don't go too well when you have !@)#&#$*%?= in the search field. So we have to build a function that searches the input string for illegal characters (defined by you) and then
....Read More |
Rating
|
|
|
|
.NET Remoting - Part II
|
Total Hit (3509) |
Remoting provides a very flexible environment for distributed applications in the .NET arena. In part one of this series of four articles (note that this is an extension of the initially planned three as indicated in article I) I introduced the background to distributed applications and the .NET rem
....Read More |
Rating
|
|
|
How Do I...Pass an Array From .NET Code to VB6 Code?
|
Total Hit (707) |
This example demonstrates how to use a .NET object from a Visual Basic 6.0 application. The same technique can be used to create the object from any COM application including those built with Visual C++ 6.0, VBScript or JScript.
|
Rating
|
|
|
How Do I...Read a text file?
|
Total Hit (1040) |
This sample retrieves information from a text file, and uses an ArrayList to display that information for the user.
Opening and reading files for read access is an important part of IO functionality, even if you do not need to write to the file in question. In this example, we open a file for read
....Read More |
Rating
|
|