Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
VB VB (1648)
VB.net VB.net (736)
C# C# (15)
ASP.net ASP.net (779)
ASP ASP (41)
VC++ VC++ (25)
PHP PHP (0)
JAVA JAVA (4)
JScript JScript (5)
  Database
» SQL Server (708)
» ORACLE (5)
» MySQL (0)
» DB2 (0)
Automation
» C/C++/ASM (11)
» Microcontroller (1)
» Circuit Design (0)
OS/Networking
» Networking (5)
» Unix/Linux (1)
» WinNT/2k/2003 (8)
Graphics
» Flash (0)
» Maya (0)
» 3D max (0)
» Photoshop (0)
Links
» ASP.net (2)
» PC Interfacing (1)
» Networking (4)
» SQL Server (4)
» VB (23)
» VB.net (4)
» VC (3)
» HTML/CSS/JavaScript (10)
Tools
» Regular Expr Tester
» Free Tools

(Page 1 of 2) 45 Result(s) found 

 

A generic benchmark routine
Total Hit (3367) You often need to benchmark a piece of code, which you usually do as follows: «Code LangId=2» Dim start As Date = Now ' insert here the code to benchmark Dim elapsed As TimeSpan = Now.Subtract(start) Console.WriteLine("Total time: {0} secs.", elapsed) «/Code» Thanks to delegates, you can w ....Read More
Rating
Add exception tracing with one line of code
Total Hit (3823) At times you want to keep a log of all the exception occurred in your application, including those that are correctly caught by a Catch block. At first you might believe that you need to add a call to the LogException procedure from each and every Catch block, which is clearly a nuisance: «Code L ....Read More
Rating
Create a unique GUID
Total Hit (4128) The System.Guid type exposes several shared and instance methods that can help you work with GUIDs, that is, those 128-bit numbers that serve to uniquely identify elements and that are ubiquitous in Windows programming. The most important member is the NewGuid shared method is useful for generating ....Read More
Rating
Create console apps that return an exit code
Total Hit (3249) Writing an application that returns an ERRORLEVEL to Dos is quite difficult in VB6, because you are forced to use a Windows API that ends the application immediately, thus preventing orderly release of resources. Conversely, this task is quite simple in VB.NET, thanks to the Exit static method of th ....Read More
Rating
Determine the size of a structure
Total Hit (4598) 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
Evaluate an expression using the Microsoft Script Control
Total Hit (3502) Thanks to COM Interop, you can still use the Microsoft Script Control from VB.NET and any other .NET language. To do so, you must add a reference to the Microsoft Script Control library (from the COM page in the Add Reference dialog box): this action creates a new reference named Interop.MSScriptCon ....Read More
Rating
Exclude code portions with the Conditional attribute
Total Hit (3239) VB developers have always used the #IF compiler directive to include or esclude portions of code from the application. The problem with this directive is that you can easily exclude a procedure with a single directive, but it isn't easy to discard all the calls to that procedure (which would raise a ....Read More
Rating
Leverage the improved Shell function
Total Hit (2990) The version of the Shell function included in VB.NET expands on the original version and supports an additional argument that enables you to specify whether to wait until the shelled program terminates, with an optional timeout. This solves an old problem known to many Visual Basic developers withou ....Read More
Rating
Providing a default value for optional arguments
Total Hit (3272) 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
Retrieving the hi/low byte/word of a value, and other operations
Total Hit (4240) As explained in the tip about the ARGBColor structure (look at the end of this tip for the link), we can define a structure and have its fields that point to the same memory address, but that read a different number of bytes. This makes easier to define a structure that allows us to set a value to a ....Read More
Rating
Use a ParamArray as a true array
Total Hit (2695) Unlike VB6, in VB.NET the ParamArray keyword defines a true array object, which you can process using any of the methods of the Array class. For example, here' s a function that evaluates the lowest value among those passed to the procedure, using the static Array.Sort method and then taking the ele ....Read More
Rating
Use the Err.GetException method to create custom exceptions
Total Hit (2922) The Visual Basic .NET Err.Raise method and the Throw command are (partially) compatible. For example, you can use a Try...End Try block to catch an error raised with the Err.Raise method, and you can use an On Error Resume Next and the Err object to neutralize and inspect an exception object created ....Read More
Rating
Using a union to retrieve the RGB components of a color
Total Hit (2933) In VB.NET you can create what in C is called a union, i.e. a particular structure where you can access the same memory with different names. Here's how you declare such a structure by using the StructLayout attribute, and specifying that you want to define the structure layout explicitly, namely how ....Read More
Rating
Using aliases to quickly change the type of variables
Total Hit (3150) It may happen that you have to define a lot of variable of some type, and you want the possibility to later change their type without manually change the declaration of all of them. You can't use a simple Find & Replace, because you don't want to change the type of ALL the variables of that original ....Read More
Rating
Write applications that take arguments
Total Hit (3862) C# has a nice feature that VB.NET lacks: the ability to define a Main procedure that takes an array of strings, each one containig one of the arguments passed on the command line. It's easy to mimick this feature in VB, though. In fact, while the Command function is still supported in VB.NET, you ....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
CompareList - Compare an argument with a list of values
Total Hit (2561) «Code LangId=2»' Return the position of the argument in a list of values ' or zero if the argument isn't included in the list ' It works for both regular values and for objects ' ' This handy function can often save you a lengthy Select Case ' statement or a complex series of If...ElseIf block ....Read More
Rating
CompareValue - Check whether a value is in a list of values
Total Hit (2700) «Code LangId=2»' Compares a numeric or string value with a list of other values. ' Returns the 1-based index of the matching value, or zero if the ' value doesn't appear in the list. ' String comparisons are case-sensitive. ' ' This function can conveniently replace a Select Case or a list ' ....Read More
Rating
DisplayExceptionInfo - Displaying error information
Total Hit (2786) «Code LangId=2» ' A reusable routine that displays error information ' Note: requires Imports System.Reflection Sub DisplayExceptionInfo(ByVal e As Exception) ' Display the error message. Console.WriteLine(e.Message) Dim st As New StackTrace(e, True) Dim i As Integer ....Read More
Rating
GetApplicationPath - Retrieving the path of the running application or add-in
Total Hit (3336) «Code LangId=2»' Return the application's path. ' Note: it also works with add-ins's dll, whereas Application.StartupPath ' returns ' Visual Studio .NET's startup path instead ' Example: MessageBox.Show(GetApplicationPath()) Function GetApplicationPath() As String Return System.IO.Pa ....Read More
Rating
IfNull - If the first argument is Nothing or a null string return the 2nd argument
Total Hit (2653) «Code LangId=2» ' If the first argument is Nothing or a null string return the 2nd argument Function IfNull(ByVal value As String, ByVal defaultValue As Object) As String If Not value Is Nothing AndAlso value.Length > 0 Then Return value Else Return CStr(defaultValue) ....Read More
Rating
IsAssembly - Check whether a specified file is a .NET assembly
Total Hit (2656) «Code LangId=2» ' Check whether a specified file is a .NET assembly Function IsAssembly(ByVal filename As String) As Boolean Try Dim asm As [Assembly] = [Assembly].LoadFrom(filename) ' if no exception is thrown, this is an assembly Return True Catch e As Excep ....Read More
Rating
IsComDLL - Check whether a DLL is an COM self-registering server
Total Hit (3040) «Code LangId=2»<System.Runtime.InteropServices.DllImport("kernel32")> Shared Function _ LoadLibrary(ByVal path As String) As Integer End Function <System.Runtime.InteropServices.DllImport("kernel32")> Shared Function _ GetProcAddress(ByVal hModule As Integer, ByVal procName As String) ....Read More
Rating
IsNumeric - Check whether an object is storing a numeric value
Total Hit (2877) «Code LangId=2»' Check whether an object is storing a numeric value ' Examples: ' Dim s As String = "hello" ' Dim d As Double = 2.4 ' Dim i As Integer = 5 ' Debug.WriteLine(IsNumeric(d)) ' => True ' Debug.WriteLine(IsNumeric(s)) ' => False ' Debug.WriteLine(IsNumeric(i) ....Read More
Rating
KeepInRange - Ensure that a value is in a given range
Total Hit (2543) «Code LangId=2» ' Keep the first argument in the range [lowLimit, highLimit] ' If the value is adjusted, the fourth (optional) argument is set to True ' ' This function works will all basic data types and with objects ' that implement the IComparable interface Function KeepInRange(ByVal va ....Read More
Rating
RunningAsExe - Determine whether the code is running in an EXE or DLL
Total Hit (2537) «Code LangId=2» ' Return True if the application is running as an EXE ' Return False if the application is running as a DLL Function RunningAsExe() As Boolean ' get the codebase of the running assembly Dim codeBase As String = Reflection.Assembly.GetExecutingAssembly.CodeBase ' ....Read More
Rating
This is a link to a different site Welcome to Visual Basic .NET
Total Hit (2371) The goal of this book is to help you come up to speed with the Visual Basic .NET language even if you have never programmed anything before. We will start slowly, and build on what we learn. So take a deep breath, let it out slowly, and tell yourself you can do this. No sweat! No kidding! This secon ....Read More
Rating
This is a link to a different site Inheritance and Interfaces : Sample Chapter from Professional VB.NET
Total Hit (1104) 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
This is a link to a different site Creating Your Own Dynamic Properties and Preserve Property Settings in Visual Basic .NET
Total Hit (995) This paper demonstrates how to create dynamic properties in addition to the ones exposed by Microsoft® Visual Basic® .NET, as well as how to use dynamic properties to persist user-configurable properties between instances of an application.
Rating
This is a link to a different site Introduction to Exception Handling in Visual Basic .NET
Total Hit (964) This article provides an overview of structured and unstructured exception handling in Visual Basic .NET. It includes considerations that help you choose the right exception-handling alternative, the approaches involved in each alternative, how to create your own exceptions, and the exception object ....Read More
Rating


(Page 1 of 2) 45 Result(s) found  1 2

Recommanded Links

 

Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.