Skip to main content


Showing posts from September, 2008


The below code perform sql transaction in VB.NET. We can use this code in C# also by making only some changes.

trans = con.BeginTransaction
com.Transaction = trans
com.Connection = con

strSql = "Insert into Departments values('005','ABC')"
db.Save(strSql, com)

strSql = "Update Departments set department_name='EF' where department_code='002"
db.Save(strSql, com)
Catch ex As Exception
End Try


To Capitalize all the characters in a string we use:

ucase( string_name )

To make all the characters of a string Small Letters we use:

lcase( string_name )

To Capitalize first letter of string we use:

StrConv( string_name , VbStrConv.ProperCase)


To interact with user before saving any record or performing a very important operation we can re ask him through dialog result by following the below method.

Dim Buttons As Integer = MessageBoxButtons.YesNo

Dim Result As DialogResult

Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)

If Result = DialogResult.Yes Then
MessageBox.Show("You choosed Yes")
MessageBox.Show("You choosed No")
End If

Invalid KeyCodeV2.dll or KeyCodeV2.dll Not Found

The reason you are getting this error is because the machine that you are trying to run your application on does not contain the drivers Crystal Report needs to run. Here is your solution:

Finding Out What the Crystal Report Distribution Key is on VS.NET 2003:

1- Open VS.NET 2003
2- Click on Help Menu Option
3- Choose "About Microsoft Development Environment"
4- Look under Crystal Reports for Visual Studio .NET, you will see a 19 character number, which is the Distribution Key Code:

Example: AAA00-BB00000-C0000DD

Producing the Deployment Project:

Open Solution Explorer, right click on the “Solution Name” at the top and Add a New Project. On the window that appears, move to Setup and Deployment Projects. Click on Setup Project (not the wizard), put a name for your deployment project (make a note of the location where the folder that the deployment project will be created in) and then click OK. A File System dialog will appear – solution explorer should be displayed on the left of scr…

How to Use VLOOKUP or HLOOKUP to find an exact match


The VLOOKUP and HLOOKUP functions contain an argument called range_lookup that allows you to find an exact match to your lookup value without sorting the lookup table.

Note It is not necessary to sort the lookup table if you use the range_lookup argument correctly.


The syntax of these functions are defined as follows.

VLOOKUP Function



Argument Definition of argument

lookup_value The value to be found in the first column of the array.

table_array The table of information in which data is looked up.

col_index The column number in the table_array for which the
matching value should be returned.

range_lookup It is a logical value that specifies whether
you want to find an exact match or an approximate match.
If TRUE or omitted, an approximate match is returned; in