Save info   Get password
Home Submit your blog Edit Account Rules RSS-Archive Contact


VB.NET Regular Expression to Check Email Addresses
2008-06-01 02:45:00
VB.NET Regular Expression to Validate Email Addresses Imports System.Text.RegularExpressions Function IsValid_eMail_Address(ByVal sEmailAdd As String) Return Regex.IsMatch(sEmailAdd, "[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_+])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}$" End Function The above will check for email like sales@dotnetdud.com etc and will reject sample@vbadud.c Or -@vbadu
Read more: Check

VB.NET Regular Expression to Check MAC Address
2008-06-01 02:44:00
Regular Expression to Validate MAC Address Imports System.Text.RegularExpressions Function IsValid_MAC_Address(ByVal sMacAdd As String) Return Regex.IsMatch(sMacAdd, "/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$") End Function The above will check for MAC Address like 22:13:35:67:49:ab etc
Read more: Check

Regular Expression to Check Zip Code
2008-06-01 02:42:00
Regular Expression to Match Zip Code Imports System.Text.RegularExpressions Function IsValidZip(ByVal sZipCode As String) Return Regex.IsMatch(sZipCode, "^\d{5}(\-\d{4})?$") End Function The above will check for U.S . Zip codes like 55001-2434. 94941-3232 etc To Check Indian Zip codes use Imports System.Text.RegularExpressions Function IsValidZip(ByVal sZ


Change the Target .NET Framework Version of an Existing Project
2008-06-20 21:56:00
Change the Target .NET Framework Version of an Existing Project This procedure describes how to change the .NET Framework version target of an existing project.To change the .NET Framework version of a project1. In Visual Studio 2008, open the project you want to change.2. Right-click the project in Solution Explorer and then click Properties. Doing this displays the Project Designer.3. Go to the T
Read more: Change

Solution for .NET Framework 2.0 update not found. The win32manifest will not be embedded.
2008-06-20 21:48:00
Solved : .NET Framework 2.0 update not found. The win32manifest will not be embedded .There are many issues when you upgrade your machine. One such issue came up with upgradation - the .NET Framework 2.0 update not found. The win32manifest will not be embedded.One way to solve this is uninstall .NET 3.5 framework and re-install it.
Read more: Solution

Preventing Office Addin from loading Everytime when Application Opens
2008-07-21 22:51:00
When add-in is created its LoadBehavior registry value is 3 in the Setup project. This results in every Office session add-in load. Change the value of 3 to 1 for not loading the add-in by defaultRegistry key is available HKEY_CLASSES_USER\Software\Microsoft\Office\\Addins\\LoadBehavior (Registry Value for LoadBehavior) (Office Addin when Automatic Loaded) Preventing Excel Addin from loading Every
Read more: Everytime , Application

Creating a Serialized Class using VB.NET
2008-07-20 21:36:00
Storing objects in a flat file using VB.NET Serialization/ Retrieving object data from file using Vb.NET Deserialization In the following example, let us look at a way by which we can make user-defined classes Serializable. The first step is to have attribute added to the class as Public Class CVideoLibraryOrder Now the objects that are derived from the classes can be serialized Im
Read more: Creating

Solution: Class must implement 'Sub OnDeserialization(sender As Object)' for interface 'System.Runtime.Serialization.IDeserializa
2008-07-20 21:34:00
Solution: Class 'CVideoLibraryOrder' must implement 'Sub OnDeserialization(sender As Object )' for interface 'System .Runtime .Serialization.IDeserializationCallback'. The above error occurs if the IDeserializationCallback.OnDeserialization is not implemented in the class, when the class has a non-serializable member Sub IDeserializationCallback_Deserialize(ByVal sender As Object) Implement
Read more: Solution

Solution for Error Type 'IDeserializationCallback' is not defined.
2008-07-20 21:31:00
This error occurs when the class implements IDeserializationCallback interface but the required import directives are not available Public Class CVideoLibraryOrder Implements IDeserializationCallback Public VID As Integer Solution : Use the following Imports statement at the beginning of the class/module Imports System.Runtime.Serialization Each source file can contain any
Read more: defined

Programmatically Change the Caption of Windows Form using C#
2008-07-20 21:29:00
Set Dialog / Form start-up position through C# code for Windows form private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Text = "New Form"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Read more: Change , Caption

Overload resolution failed because no accessible 'New' can be called with these arguments:
2008-07-20 21:27:00
'Public Sub New(handle As Microsoft.Win32.SafeHandles.SafeFileHandle, access As System.IO.FileAccess)': Argument not specified for parameter 'handle'. 'Public Sub New(handle As System.IntPtr, access As System.IO.FileAccess)': Argument not specified for parameter 'handle'. 'Public Sub New(path As String, mode As System.IO.FileMode)': Argument not specified for parameter 'path'. O
Read more: arguments

Office host applications and their support for add-ins
2008-07-20 21:23:00
Host Shared Add-In VSTO 2005 SE Add-In Access 2003 Yes No Excel 2003 Yes Yes FrontPage 2003 Yes No Outlook 2003* Yes Yes PowerPoint 2003 Yes Yes Project 2003 Yes No Publisher 2003


Get Stored Text from Clipboard using VB.NET
2008-08-12 06:59:00
Extract Text from Clipboard using Vb.NET / Extract Clipboard Text from using Vb.NET Sub Get_Text_From_ClipBoard() Try If My.Computer.Clipboard.ContainsText() Then Dim ClipText As String ClipText = My.Computer.Clipboard.GetText MsgBox(ClipText) Else MsgBox("No Text in ClipBoard") End If


Get Stored Images from Clipboard using VB.NET
2008-08-12 06:59:00
Extract Images from Clipboard using Vb.NET Sub Get_Image_From_ClipBoard() Try If My.Computer.Clipboard.ContainsImage() Then Dim ClipImage As System.Drawing.Image ClipImage = My.Computer.Clipboard.GetImage Me.Background = ClipImage Else MsgBox("No Images in ClipBoard") End If Catch ex


Clear Clipboard Content using VB.NET
2008-08-12 06:59:00
VB.NET Code to Delete Clipboard Content s Sub Delete_ClipBoard_Content() Try My.Computer.Clipboard.Clear () Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub


Validate Windows Form Controls in Vb.Net
2008-08-01 00:06:00
Validation Controls for Windows Forms (VB.NET) The Windows Forms ErrorProvider component is used to validate user input on a form or control. It is typically used in conjunction with validating user input on a form, or displaying errors within a dataset. An error provider is a better alternative than displaying an error message in a message box, because once a message box is dismissed, the error m
Read more: Validate

Visual Studio 2008 Image Library
2008-08-01 00:06:00
The Visual Studio 2008 Image Library is a collection of application images that appear in Microsoft Windows, Microsoft Office, Microsoft Visual Studio , and other Microsoft software. You can use this set of over 1,000 images to create applications that look visually consistent with Microsoft software.The image library includes three main categories of images: animations, bitmaps, and icons. A readm


Calculating Time taken for an operation using VB.NET (in Milliseconds)
2008-08-01 00:06:00
Calculate Processing Time for a Vb.NET Subroutine (accuracy to millisecond)Not every project will have the luxury of having rational analyzer to check the process time for every subroutine/function. In those cases we can use the StopWatch to determine the time taken for a programImports System.Diagnostics Sub Get_Accurate_ProcessTime() Dim oWatch As New Stopwatch oWatch.Start()


Use of unassigned local variable 'name'
2008-08-25 00:44:00
The C# compiler does not allow the use of uninitialized variables. If the compiler detects the use of a variable that might not have been initialized, it generates CS0165. string Sample; Nullable FlagComplete = null; if (FlagComplete.HasValue) { MessageBox.Show(Sample); } Use new to create an instance of an object o


Argument '1': cannot convert from 'System.Text.StringBuilder' to 'string'
2008-08-25 00:44:00
Use ‘ToString’ to convert the StringBuilder to String // Appending String - using String Builder System .Text.StringBuilder CompleteAddress1 = new System.Text.StringBuilder(); CompleteAddress1.Append( "105, Annanagar "); CompleteAddress1.Append( "Chennai "); CompleteAddress1.Append( "Tamil Nadu "); // Error Code
Read more: Argument

Avoiding Temporary Strings in C# / Reduce Unnecessary Garbage Collection in C#
2008-08-25 00:44:00
Appending strings to existing will produce garbage collection overhead for the program. Instead use Append method of StringBuilder class or Concat, Join methods of String classThe following code differentiates between both : private void stringbuilder_example() { // Appending String - Garbage Collection - Immutable string CompleteAddress = ""; Comp
Read more: Temporary

The best overloaded Add method 'name for the collection initializer has some invalid arguments in ‘ToString’
2008-08-25 00:44:00
The type of one argument in a method does not match the type that was passed when the class was instantiated.The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments Solution : One possible solution is to check if the ‘ToString’ has braces System.Text.StringBuilder CompleteAddress1 = new System.Text.StringBuilder();
Read more: collection

Nullable Variables in C#
2008-08-25 00:44:00
A type is said to be nullable if it can be assigned a value or can be assigned nullNothingnullptra null reference (Nothing in Visual Basic), which means the type has no value whatsoever. Consequently, a nullable type can express a value, or that no value exists. For example, a reference type such as String is nullable, whereas a value type such as Int32 is not. A value type cannot be nullable bec


No title
2008-08-25 00:44:00



No title
2008-08-25 00:44:00



A new expression requires (), [], or {} after type (C# Excel Application)
2008-08-25 00:44:00
The new operator, used to dynamically allocate memory for an object, was not specified correctly. (Compiler Error CS1526) Replace oXL = new Microsoft.Office.Interop.Excel .application; with oXL = new Microsoft.Office.Interop.Excel.application();
Read more: expression , Application

Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the
2008-08-25 00:44:00
An array was declare d incorrectly. Be aware that the syntax for a fixed size buffer is different from that of an array. - Compiler Error CS0650Wrong Declarationchar CopiedString[];char[] CopiedString;Correct Declaration char[] CopiedString = new char[3]; Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, us


Using Directive in C#, Create an alias in C#
2008-08-25 00:44:00
Before you can use the classes in a given namespace in a C# program, you must add a using directive for that namespace to your C# source file. In some cases, you must also add a reference to the DLL that contains the namespaceThe using directive has two uses:· To allow the use of types in a namespace so that you do not have to qualify the use of a type in that namespace:using System;using
Read more: Directive

Creating Simple Windows Forms Application using C#
2008-08-25 00:44:00
1. Start Visual Studio.2. Create a Windows Application called HelloWorld. 3. From the Toolbox, drag a Label control onto the form.4. Double Click the label to add an event handler.5. Insert the following code: private void label1_Click(object sender, EventArgs e) { MessageBox.Show("Hello World"); } How to create Windows Forms Appl
Read more: Creating , Simple

DateSerial Function in VB.NET / Check if the Date is in DayLightSaving Range using VB.NET
2008-08-14 21:49:00
How to Check if the Date is in DayLightSaving Range using VB.NETVB.NET’s DAteTime function can be used to give the same output VBA’s DateSerial function Sub GetDate() Dim MyDate As DateTime MyDate = New DateTime(2008, 8, 15) MsgBox(DateSerial(2008, 8, 15)) If MyDate.IsDaylightSavingTime() = True Then MsgBox("Specified day is within daylightsaving time") End If End Sub


Page 2 of 3 « < 1 2 3 > »
eXTReMe Tracker