This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Thursday, February 5, 2009

Text Encryption with a Password in ASP

Text Encryption with a Password in ASP

Version: ASP
Compatibility: ASP3.0
Category: ASP


This is a text encryption/decryption snippet that utilizes the powerful xICE encryption algorithm. It's extremely simple to use.

To encrypt use:
QuickEncrypt("your text","password")

To decrypt just use:
QuickDecrypt("encrypted text here","password").


Declarations:
Dim dblCenterY
Dim dblCenterX
Dim LastResult
Dim LastErrDes
Dim LastErrNum
Const errInvalidKeyLength = 65101
Const errInvalidKey = 65102
Const errInvalidSize = 65103
Const errKeyMissing = 65303
Const errClearTextMissing = 65304
Const errCipherTextMissing = 65305
Const A = 10
Const B = 11
Const C = 12
Const D = 13
Const E = 14
Const F = 15


Code:
Function QuickEncrypt(strClear, strKey)

Dim intRet
intRet = EncryptText(strClear, strKey)

If intRet = -1 Then
QuickEncrypt = "ERROR"
Else
QuickEncrypt = LastResult
End If

End Function

Function QuickDecrypt(strCipher, strKey)
Dim intRet
intRet = DecryptText(strCipher, strKey)

If intRet = -1 Then
QuickDecrypt = "ERROR"
Else
QuickDecrypt = LastResult
End If
End Function

Function GetStrength(strPassword)

strPassword = CStr(strPassword)

GetStrength = (Len(strPassword) * 8) + (Len(GetSerial) * 8)

End Function

Function GetSerial()

GetSerial = Now

End Function

Function GetHash(strKey)
Dim strCipher
Dim byKey()

ReDim byKey(Len(strKey))

For i = 1 To Len(strKey)

byKey(i) = Asc(Mid(strKey, i, 1))

Next

For i = 1 To UBound(byKey) / 2

strCipher = strCipher & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1))

Next

GetHash = strCipher

End Function

Function CreatePassword(strSeed, lngLength)
Dim bySeed()
Dim bySerial()
Dim strTimeSerial
Dim Random
Dim lngPosition
Dim lngSerialPosition

strCipher = ""

lngPosition = 1
lngSerialPosition = 1

ReDim bySeed(Len(strSeed))

For i = 1 To Len(strSeed)

bySeed(i) = Asc(Mid(strSeed, i, 1))

Next

strTimeSerial = GetSerial()

ReDim bySerial(Len(strTimeSerial))

For i = 1 To Len(strTimeSerial)

bySerial(i) = Asc(Mid(strTimeSerial, i, 1))

Next

ReCenter CDbl(bySeed(lngPosition)), CDbl(bySerial(lngSerialPosition))

lngPosition = lngPosition + 1
lngSerialPosition = lngSerialPosition + 1

For i = 1 To (lngLength / 2)

Generate CDbl(bySeed(lngPosition)), CDbl(bySerial(lngSerialPosition)), False

strCipher = strCipher & NumToHex(MakeRandom(dblCenterX, 255))
strCipher = strCipher & NumToHex(MakeRandom(dblCenterY, 255))

If lngPosition = Len(strSeed) Then
lngPosition = 1
Else
lngPosition = lngPosition + 1
End If

If lngSerialPosition = Len(strTimeSerial) Then
lngSerialPosition = 1
Else
lngSerialPosition = lngSerialPosition + 1
End If

Next

CreatePassword = Left(strCipher, lngLength)

End Function

Sub ReCenter(mdblCenterY, mdblCenterX)

dblCenterY = mdblCenterY
dblCenterX = mdblCenterX

End Sub

Sub Generate(dblRadius, dblTheta, blnRad)

Const Pi = 3.14159265358979
Const sngMaxUpper = 2147483647
Const sngMaxLower = -2147483648

If blnRad = False Then

If (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX > sngMaxUpper Or (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX < sngMaxLower Then


ReCenter dblCenterY, 0

Else

dblCenterX = (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX

End If

If (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY > sngMaxUpper Or (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY < sngMaxLower Then

ReCenter 0, dblCenterX

Else

dblCenterY = (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY

End If

Else

If (dblRadius * Cos(dblTheta)) + dblCenterX > sngMaxUpper Or (dblRadius * Cos(dblTheta)) + dblCenterX < sngMaxLower Then

ReCenter dblCenterY, 0

Else

dblCenterX = (dblRadius * Cos(dblTheta)) + dblCenterX

End If

If (dblRadius * Sin(dblTheta)) + dblCenterY > sngMaxUpper Or (dblRadius * Sin(dblTheta)) + dblCenterY < sngMaxLower Then

ReCenter 0, dblCenterX

Else

dblCenterY = (dblRadius * Sin(dblTheta)) + dblCenterY

End If

End If

End Sub

Function MakeRandom(dblValue, lngMax)

Dim lngRandom

lngRandom = Int(dblValue Mod (lngMax + 1))

If lngRandom > lngMax Then

lngRandom = 0

End If

MakeRandom = Abs(lngRandom)

End Function

Sub RaiseError(lngErrNum, strErrDes)

LastErrDes = strErrDes
LastErrNum = lngErrNum

End Sub

Function EncryptText(strClear, strKey)

Dim byClear()

Dim byKey()

Dim byCipher()

Dim lngPosition

Dim lngSerialPosition

Dim strTimeSerial

Dim blnSecondValue

Dim strCipher

strKey = CStr(strKey)

strClear = CStr(strClear)

If strKey = "" Then

RaiseError errKeyMissing, "Key Missing"
EncryptText = -1
Exit Function

End If

If Len(strKey) <= 1 Then

RaiseError errInvalidKeyLength, "Invalid Key Length"
EncryptText = -1
Exit Function

End If

strTimeSerial = GetSerial()

ReDim byKey(Len(strKey))

For i = 1 To Len(strKey)

byKey(i) = Asc(Mid(strKey, i, 1))

Next

If Len(strClear) = 0 Then

RaiseError errInvalidSize, "Text Has Zero Length"
EncryptText = -1
Exit Function

End If

ReDim byClear(Len(strClear))

For i = 1 To Len(strClear)

byClear(i) = Asc(Mid(strClear, i, 1))

Next

lngPosition = 1

lngSerialPosition = 1

For i = 1 To UBound(byKey) / 2

strCipher = strCipher & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1))

Next

lngPosition = 1

strCipher = strCipher & NumToHex(Len(strTimeSerial) Xor byKey(lngPosition))

lngPosition = lngPosition + 1

For i = 1 To Len(strTimeSerial)

strCipher = strCipher & NumToHex(byKey(lngPosition) Xor Asc(Mid(strTimeSerial, i, 1)))

If lngPosition = UBound(byKey) Then

lngPosition = 1

Else

lngPosition = lngPosition + 1

End If

Next

lngPosition = 1

lngSerialPosition = 1

ReCenter CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1))

lngPosition = lngPosition + 1

lngSerialPosition = lngSerialPosition + 1

blnSecondValue = False

For i = 1 To UBound(byClear)

If blnSecondValue = False Then

Generate CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)), False

strCipher = strCipher & NumToHex(byClear(i) Xor MakeRandom(dblCenterX, 255))

blnSecondValue = True

Else

strCipher = strCipher & NumToHex(byClear(i) Xor MakeRandom(dblCenterY, 255))

blnSecondValue = False

End If


If lngPosition = UBound(byKey) Then

lngPosition = 1

Else

lngPosition = lngPosition + 1

End If

If lngSerialPosition = Len(strTimeSerial) Then

lngSerialPosition = 1

Else

lngSerialPosition = lngSerialPosition + 1

End If

Next

LastResult = strCipher

EncryptText = 1

Exit Function

End Function

Public Function DecryptText(strCipher, strKey)

Dim strClear

Dim byCipher()

Dim byKey()

Dim strTimeSerial

Dim strCheckKey

Dim lngPosition

Dim lngSerialPosition

Dim lngCipherPosition

Dim bySerialLength

Dim blnSecondValue

strCipher = CStr(strCipher)


strKey = CStr(strKey)

If Len(strCipher) = 0 Then

RaiseError errCipherTextMissing, "Cipher Text Missing"
DecryptText = -1
Exit Function

End If

If Len(strCipher) < 10 Then

RaiseError errInvalidSize, "Bad Text Length"
DecryptText = -1
Exit Function

End If

If Len(strKey) = 0 Then

RaiseError errKeyMissing, "Key Missing"
DecryptText = -1
Exit Function

End If

If Len(strKey) <= 1 Then

RaiseError errInvalidKeyLength, "Invalid Key Length"
DecryptText = -1
Exit Function

End If

ReDim byKey(Len(strKey))

For i = 1 To Len(strKey)

byKey(i) = Asc(Mid(strKey, i, 1))

Next

ReDim byCipher(Len(strCipher) / 2)

lngCipherPosition = 1

For i = 1 To Len(strCipher) Step 2

byCipher(lngCipherPosition) = HexToNum(Mid(strCipher, i, 2))

lngCipherPosition = lngCipherPosition + 1

Next

lngCipherPosition = 1

For i = 1 To UBound(byKey) / 2

strCheckKey = strCheckKey & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1))

Next

If Left(strCipher, Len(strCheckKey)) <> strCheckKey Then

RaiseError errInvalidKey, "Invalid Key"
DecryptText = -1
Exit Function

Else

lngCipherPosition = (Len(strCheckKey) / 2) + 1

End If

lngPosition = 1

bySerialLength = byCipher(lngCipherPosition) Xor byKey(lngPosition)

lngCipherPosition = lngCipherPosition + 1

lngPosition = lngPosition + 1

For i = 1 To bySerialLength

strTimeSerial = strTimeSerial & Chr(byCipher(lngCipherPosition) Xor byKey(lngPosition))

If lngPosition = UBound(byKey) Then

lngPosition = 1

Else

lngPosition = lngPosition + 1

End If

lngCipherPosition = lngCipherPosition + 1

Next

lngPosition = 1

lngSerialPosition = 1

ReCenter CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1))

lngPosition = lngPosition + 1

lngSerialPosition = lngSerialPosition + 1

blnSecondValue = False

For i = 1 To UBound(byCipher) - lngCipherPosition + 1

If blnSecondValue = False Then

Generate CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)), False

strClear = strClear & Chr(byCipher(lngCipherPosition) Xor MakeRandom(dblCenterX, 255))

blnSecondValue = True

Else

strClear = strClear & Chr(byCipher(lngCipherPosition) Xor MakeRandom(dblCenterY, 255))

blnSecondValue = False

End If


If lngPosition = UBound(byKey) Then

lngPosition = 1

Else

lngPosition = lngPosition + 1

End If

If lngSerialPosition = Len(strTimeSerial) Then

lngSerialPosition = 1

Else

lngSerialPosition = lngSerialPosition + 1

End If

lngCipherPosition = lngCipherPosition + 1

Next

LastResult = strClear


DecryptText = 1




Exit Function

End Function


Function NumToHex(bByte)

Dim strOne
Dim strTwo

strOne = CStr(Int((bByte / 16)))
strTwo = bByte - (16 * strOne)

If CDbl(strOne) > 9 Then
If CDbl(strOne) = 10 Then
strOne = "A"
ElseIf CDbl(strOne) = 11 Then
strOne = "B"
ElseIf CDbl(strOne) = 12 Then
strOne = "C"
ElseIf CDbl(strOne) = 13 Then
strOne = "D"
ElseIf CDbl(strOne) = 14 Then
strOne = "E"
ElseIf CDbl(strOne) = 15 Then
strOne = "F"
End If
End If

If CDbl(strTwo) > 9 Then
If strTwo = "10" Then
strTwo = "A"
ElseIf strTwo = "11" Then
strTwo = "B"
ElseIf strTwo = "12" Then
strTwo = "C"
ElseIf strTwo = "13" Then
strTwo = "D"
ElseIf strTwo = "14" Then
strTwo = "E"
ElseIf strTwo = "15" Then
strTwo = "F"
End If
End If

NumToHex = Right(strOne & strTwo, 2)
End Function

Function HexToNum(hexnum)
Dim X
Dim y
Dim cur

hexnum = UCase(hexnum)

cur = CStr(Right(hexnum, 1))

Select Case cur
Case "A"
y = A
Case "B"
y = B
Case "C"
y = C
Case "D"
y = D
Case "E"
y = E
Case "F"
y = F
Case Else
y = CDbl(cur)
End Select


Select Case Left(hexnum, 1)

Case "0"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "1"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "2"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "3"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "4"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "5"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "6"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "7"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "8"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "9"
X = (16 * CInt(Left(hexnum, 1))) + y
Case "A"
X = 160 + y
Case "B"
X = 176 + y
Case "C"
X = 192 + y
Case "D"
X = 208 + y
Case "E"
X = 224 + y
Case "F"
X = 240 + y

End Select

HexToNum = X

End Function

Multi User Login & Authentication in ASP

Multi User Login & Authentication in ASP

Version: ASP
Compatibility: ASP3.0
Category: ASP


Multi-User Login & User Authentication with database connectivity. The files includes - login, Registration, Password Retrieving, Authentication and added files. Plus Admin files for viewing and editing database content online.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Online Job Management System in ASP

Online Job Management System in ASP

Version: ASP
Compatibility: ASP3.0
Category: ASP


A complete ready to go website dedicated to Online Hunting for Jobs. Ideal for Employees and Employers where both can create and build CVs and Vacancies Online and post their data. Tools include job searching and great tip for Career Building, Interview Preparation and CV Writing etc and more...


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Using DataGridView in VB.net

Using DataGridView in VB.net

Version: VB 2005
Compatibility: VB 2005
Category: Databases


A Document containing how to use efficiently DataGrid, to add in DataGrid, Modify and Remove from the Grid and View of Data with ComboBox in VisualBasic.net.

A very good tool for the developer who want to make use of DataGrid frequently.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Geocoding a Physical Address (VB.Net)

Geocoding a Physical Address (VB.Net)

Version: VB 2005
Compatibility: VB 2005
Category: Internet Programming


This article will demonstrate the basics of submitting an address to the Yahoo! Geocoding service, recovering and displaying the geocoded result, and will also demonstrate a simple approach to displaying the location as mapped using Yahoo maps. For more information regarding the program refer directly the Yahoo Developer Network website located at http://developer.yahoo.com/dotnet/.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Friday, January 30, 2009

how to Read a GPS Device in VB

Read a GPS Device in VB

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This article shall describe a very simple approach to working with a GPS device within the context of a Visual Basic 2005 application. This article does not address how the GPS device works or everything that can be gleaned from the NEMA 0183 string outputted from most GPS devices; rather, the article is intended for those just interested in getting present position from a GPS and using that point to do something interesting like show you where you are on a map.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Transparent Borderless Forms in Visual Basic 2005(vb.net)

Transparent Borderless Forms in Visual Basic 2005

Version: VB 2005
Compatibility: VB 2005
Category: Forms

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This article describes an approach to displaying transparent forms in a Windows application. Such may be useful to anyone wishing to display an odd shaped form for a splash screen or possibly a tool dialog with a transparent background.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

VB.NET Form with Animation(vb.net)

VB.NET Form with Animation

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005
Category: Forms

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple vb.net form with animation for beginners.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Friday, January 23, 2009

Work With OracleDependency(vb.net)

Work With OracleDependency(vb.net)

Version: VB 2005
Compatibility: VB 2005
Category: Databases

'With the introduction of Oracle Database 10g Release 2, you have a new option that addresses the
'Limitations inherent in previous approaches to dealing with changing data: database change notification.
'When you use database change notification, the database server will notify you automatically when an
'Event occurs that changes objects associated with a specific query.
'Using the database change notification feature is a three-step process:

Declarations:
'Add Oracle Data Access Layer

Code:
Imports System
Imports System.Data
Imports System.Threading

Imports Oracle
Imports Oracle.DataAccess.Client

Public Class FrmOraDep

'With the introduction of Oracle Database 10g Release 2, you have a new option that addresses the
'Limitations inherent in previous approaches to dealing with changing data: database change notification.
'When you use database change notification, the database server will notify you automatically when an
'Event occurs that changes objects associated with a specific query.
'Using the database change notification feature is a three-step process:

'1. Registration: During the registration process, you specify a query that the database should watch for
'Changes. ODP.NET automatically registers the events to watch for, based on the query. The database
'Watches for Data Manipulation Language (DML) events, Data Definition Language (DDL) events, and
'Global events. (A DML event occurs when the underlying data of a query is changed. A DDL event
'Occurs when the structure of an object in the query is changed. A global event occurs when an action
'With a greater scope than the query alone takes place-the database is shut down, for example.)

'2. Notification: Once a query has been registered with the database for change notification, you specify
'how you would like to receive that notification. You can receive the notification-automatically from the
'Database-as an event in your application code, or you can poll the database. Most database change
'notification applications have the database automatically alert end users about changes, rather than
'using polling. (Note that ODP.NET needs to open a client network port to listen for the notification
'message from the database.)

'3. Response: Your application responds to the change notification by taking some action, as
'appropriate. In most cases, you'll automatically update the cached data without requiring end user
'interaction. Alternatively, you can notify the user that the data has changed and ask if the user would
'like to update the cached data.



'For your application to utilize change notification, the application's database user must have the
'CHANGE NOTIFICATION database privilege. Before running the code in Listing 1, run the following
'statement, using a DBA connection in a tool such as SQL*Plus or Oracle Developer Tools for Visual
'Studio .NET, to ensure that the HR user can use the change notification feature:
'grant change notification to hr;

Private OraCon As OracleConnection = Nothing
Private OraCom As OracleCommand = Nothing
Private OraPrm As OracleParameter = Nothing

Private OraDep As OracleDependency = Nothing
Private IsNotified As Boolean = False

Private Sub ButtonOpenConnection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOpenConnection.Click

Me.Cursor = Cursors.WaitCursor

Try
If OraCon Is Nothing Then
OraCon = New OracleConnection("Data Source=RAS04;Persist Security Info=True;User ID=GEHAN;Password=gehan456;Pooling=False")
OraCon.Open()
End If

MessageBox.Show("Oracle Connection Open.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)

ButtonUpdateTable.Enabled = True
ButtonUpdateTable.Focus()
Catch ex As Exception
ButtonUpdateTable.Enabled = False
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

Me.Cursor = Cursors.Default

End Sub

Private Sub ButtonUpdateTable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonUpdateTable.Click

Me.Cursor = Cursors.WaitCursor

Try
If OraCon.State = ConnectionState.Closed Then OraCon.Open()

Dim SELECT_Str As String = "SELECT FIRSTNAME,LASTNAME,SALARY FROM employees WHERE EMPLOYEEID = 1"
OraCom = New OracleCommand()
With OraCom
.Connection = OraCon
.CommandType = CommandType.Text
.CommandText = SELECT_Str
End With

OracleDependency.Port = 1005
OraDep = New OracleDependency(OraCom)
OraCom.Notification.IsNotifiedOnce = False

AddHandler OraDep.OnChange, AddressOf OraDep_OnChange

OraCom.ExecuteNonQuery()

Dim UPDATE_Str As String = "UPDATE employees SET SALARY = SALARY + 10 WHERE EMPLOYEEID = 1"
Dim Trn As OracleTransaction = OraCon.BeginTransaction
Dim UpdateCmd As New OracleCommand(UPDATE_Str, OraCon)
UpdateCmd.ExecuteNonQuery()
Trn.Commit()

OraCon.Close()
While (IsNotified = False)
Application.DoEvents()
Debug.WriteLine("Wait For Notification....")
System.Threading.Thread.Sleep(500)
End While

MessageBox.Show("Work Completed")
Catch ex As Exception
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
OraDep = Nothing
OraCom = Nothing
End Try
Me.Cursor = Cursors.Default

End Sub

Private Sub FrmOraDep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ButtonUpdateTable.Enabled = False

End Sub

Private Sub OraDep_OnChange(ByVal sender As Object, ByVal eventArgs As Oracle.DataAccess.Client.OracleNotificationEventArgs)

Debug.WriteLine("Database Change Notification Received.")
Dim DTable As DataTable = eventArgs.Details
Debug.WriteLine("Resource {0} Has Changed." + DTable.Rows(0)(0))
IsNotified = True

End Sub

End Class

A simple tool to generate a VB.Net class

A simple tool to generate a VB.Net class

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This is a simple tool to generate a VB.Net class. Need .Net Framework 2.0 to run.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

XML Pathfinder - A Visual Basic Utility(vb.net)

XML Pathfinder - A Visual Basic Utility(vb.net)

Version: VB 2005
Compatibility: VB 2005
Category: XML

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This article discusses the construction of a simple utility that may be used to locate and evaluate paths within an XML document, and to test queries against those paths.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Building a UNIX Time to Date Control(vb.net)

Building a UNIX Time to Date Control(vb.net)

Version: VB 2005
Compatibility: VB 2005
Category: Date/Time

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This article addresses the construction of a custom control that will convert UNIX time into useful and readable dates for display in a Win Forms application.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Parsing Sentences and Building Text Statistics(vb.net)

Parsing Sentences and Building Text Statistics(vb.net)

Version: VB 2005
Compatibility: VB 2005
Category: String Manipulation

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This article describes three approaches to parsing the sentences from a body of text. It also describes an approach to generating sentence count, word count, and character count statistics.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple RSS Feed Reader(vb.net)

Simple RSS Feed Reader(vb.net)

Version: VB 2005
Compatibility: VB 2005
Category: Internet Programming

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

The article describes the construction of a simple RSS feed reader based upon some easy XPath work.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Bubble Sort (VB.NET)

Bubble Sort (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Bubble sorting using vb.net.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Scientific Calculator (VB.NET)

Scientific Calculator (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Mathematics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

It is an advanced scientific calculator. plz contact me for further assistance...


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

noIE Process Execution Prevention (VB.NET)

noIE Process Execution Prevention (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Application to prevent internet explorer, or any application for that matter, from executing. I dont know how useful it would be to others, but i figured to would serve some educational purposes. Very little commenting, but is pretty short and sweet. i originally made this app as a short term solution to some sort of malware i picked up that caused internet explorer pop-ups anytime internet activity was detected. This demonstrates process management as well as some windows forms implimentations.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Converting English Characters To Arabic(VB.NET)

Converting English Characters To Arabic(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: String Manipulation


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

I have so much problem in typing arabic Characters.

This application makes arabic typing so simple so just type in english and the character will be automaticlly changed to arabic Enjoy!!!


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Image Resizer 2.0(VB.NET)

Image Resizer 2.0(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Graphics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This application resize any type of picture and save it to disk in another extension without losing the quality of the picture. Enjoy it.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Automatic Mail Generator (VB.NET)

Automatic Mail Generator (VB.NET)

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005
Category: Internet Programming

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

It will send email to 1000 of recepient at a time by the help of OUTLOOK.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

File Folder Hirerchy to XML(vb.net)

File Folder Hirerchy to XML(vb.net)

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005
Category: File Manipulation

This code generates an XML file in the given directory with contents same as Explorer hierarchy. It also displays the files size and change date including folders description like Number of files or folders.
It can be used when you want to make a CD/DVD with many number of files and this xml file helps to find out the files/folders snapshots in a single look.


Declarations:
Imports System.IO

Dim Trgt As StreamWriter
Dim T1 As Threading.Thread

'Place on Textbox and and button. Give the path of
'the root folder in textbox1 and click the button.

Code:
Sub CreateXMLPath()
Trgt = New StreamWriter(TextBox1.Text & "\index.xml")
Trgt.WriteLine(" ")
Trgt.WriteLine("")
Text = "Started"
Trgt.WriteLine("Ajay ")
Trgt.WriteLine("" & DateTime.Now & " ")
ScanFolder(TextBox1.Text)
Trgt.WriteLine("
")
Trgt.Close()
Text = "Completed"
End Sub
Sub ScanFolder(ByVal FldName As String)
'On Error GoTo NextSub
Dim S As String

Dim TotFiles, TotFolders, TotSize As Long
Dim sZ As Double
Dim Fld As New DirectoryInfo(FldName), Fl As FileInfo
Dim MainFld As New DirectoryInfo(FldName)
Trgt.WriteLine("")
For Each Fld In MainFld.GetDirectories
Text = "Scanning folder " & FldName
ScanFolder(Fld.FullName())
TotFolders += 1
Next
For Each Fl In MainFld.GetFiles
TotFiles += 1
S = Fl.FullName
If Fl.Name <> "index.xml" Then
sZ = Math.Round(Fl.Length / 1024, 2)
Trgt.WriteLine("")
TotSize += Fl.Length
End If
Next
Trgt.WriteLine("

")
Trgt.WriteLine("")
NextSub:
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
T1 = New Threading.Thread(AddressOf CreateXMLPath)
T1.Start()
End Sub

'Replace the invalid charactes for XML with valid one

Function ParseXML(ByVal S As String) As String
S = S.Replace("&", "&")
S = S.Replace("'", "")
S = S.Replace("""", "")
Return S
End Function

Active Directory Finder (VB.NET)

Active Directory Finder (VB.NET)

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005, VB 2008
Category: Networking


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This project will detect your system information and your belonging groups.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Transposition Encryption (VB.NET)

Transposition Encryption (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Security

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

In transposition and geometrical pattern encoding the text is rearranged with the aid of some type of geometric figure, a typical example being a two - dimensional array or a matrix, First plain text message is written into the figure according to a particular matrix, the cipher text then created by taking the letters off the matrix according to a different path.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

XML To Email(VB.NET)

XML To Email(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: XML

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


I have done this project to learn more about the XML and in addition this will send email in a multi threaded fashion along with reports .....


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Thursday, January 22, 2009

Document Management System (VB.NET)

Document Management System (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

If Any Body Like To Save Complete MS Access Database, MS Word File, Excel File, Power Point, Images And Text Files Save In SQL Sever 2005, This The Complete Solution ....... Document Management System 2008 With One way Encryption Method And With Lots Of Features.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Network Monitor (VB.NET)

Network Monitor (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Networking

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This is a real time application for network administrators to keep a watch on network machines. It is a good tool for tracking status of remote machines in network, it gives a warning message to the user when the state of remote machine changes. over all I have tried to create a very easy to use application for network admins. Any suggestions regarding this applications are always welcome.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Folder Lock (VB.NET)

Folder Lock (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Controls

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

This application will lock the particuler folder by giving the password and unlock that by giving the same password.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Reminder Guru (VB.NET)

Reminder Guru (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Date/Time

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

The application will store all the appointments and pops up the reminder at the proper time.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Folder Hider (VB.NET)

Folder Hider (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Security

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


This is a privacy tool in which you can hide a folder and set password to your application.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Sort a matrix (VB.NET)

Sort a matrix (VB.NET)

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005
Category: Mathematics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

In this program you can sort the whole matrix and then we can display the whole sorted matrix. You can sort matrix of any order.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

List Available SQL Server(VB.NET)

List Available SQL Server(VB.NET)
Version: VB 2005
Compatibility: VB 2005
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


This code will display the available sql server in combo box.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Calculator in VB 2005 (VB.NET)

Calculator in VB 2005 (VB.NET)
Version: VB 2005
Compatibility: VB 2005
Category: Mathematics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Basic .net Calculator For .net Developers. In This Application U Can Add, Multiply, Substract, Divide And Other Features.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Remote Control Car (VB.NET)

Remote Control Car (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

My Final grade 12 Project was to controll a car useing the computer. Well, this is what i've come up with.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Meta Search Engine (VB.NET)

Meta Search Engine (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Internet Programming


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Meta Search Engine is a concept where we will take the search query and then passes it to many search engines and then filtering the duplicates and then doing the ranking. This is Known as Meta Search Engine...

I have implemented the same in this project using Google, Yahoo and MSN's Web Services.

Finally, the Motto Of the Project is to Get the Top 10 Results From the Top 3 Search Engine.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Glass Message Box (VB.NET)

Glass Message Box (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Controls

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

The {R4} Glass Effect Message Box Well-matched For Windows XP.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Work With MS Agent 2.0 (VB.NET)

Work With MS Agent 2.0 (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Forms

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Get all animations and play with animations.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Memory Checker (VB.NET)

Memory Checker (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Get Memory Details Through WMI Class.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Data Save Using Oracle 8i (VB.NET)

Data Save Using Oracle 8i (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


Data Save, Search, Update, Delete to be done in this program.

Environment: Front End: VB.NET 2005 Back End: Oracle 8i.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple Calendar with Time (VB.NET)

Simple Calendar with Time (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Date/Time

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

At work our microsoft calendar is blocked. So i created a calendar with time to be in the background. You can also blend it with the desktop. If you go to much or to less it will warn you and reset to original state. It was designed to run in the background.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

netSMS - send sms (VB.NET)

netSMS - send sms (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Internet Programming

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Lets you send SMS messages for free.
Includes example project and source code.

netSMS - DLL / Class Library for sending SMS messages
SMSDebug - Example Project


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Get and set a new printer(VB.NET)

Get and set a new printer(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

Get and set a new printer.

Declarations:
none

Code:
Public Class Printers
'''


''' Eingetragene Drucker ermitteln und an StringCollection zur
''' Ausgabe übergeben
'''

Public Shared Function GetPrinters() As StringCollection
'Beöetigte Variablen deklarieren
Dim sc As StringCollection = New StringCollection()
Dim scope As String = "ROOT\CIMV2"
Dim query As String = "Select * from Win32_Printer"

Dim Printers As New ManagementObjectSearcher(scope, query)

' Schleife durchlaufen und ermittelte Drucker an...
' StringCollection übergeben
For Each Printer As ManagementObject In Printers.Get()
Dim PrinterDescription As String = _
DirectCast(Printer.GetPropertyValue("Name"), String)
sc.Add(PrinterDescription)
Next
Return sc
End Function
End Class
Public Class OS
' Win98 WinMe WinNT Win2K WinXP Server2003 Vista/Longhorn
' Platform 1 1 2 2 2 2 2
' Version.Major 4 4 4 5 5 5 6
' Version.Minor 10 90 0 0 1 2 0

'''
''' Betriebsystem ermitteln
'''

Public Shared Function IsWindowsXPOrHigher() As Boolean
If OSVersion.Platform <> PlatformID.Win32NT OrElse _
OSVersion.Version < New Version(5, 1) Then
' Stimmt das Ergebnis mit dem Vergleich ueberein
' wird True zurueckgegeben...
Return False
Else
' ... sonst False
Return True
End If
End Function
End Class
Public Class SetPrinter
'''
''' Neuen Standard-Drucker systemweit setzen
'''

Public Shared Function ChangePrinter(ByVal PrinterName As String) As Boolean
' Benötigte Variablen
Dim scope As String = "ROOT\CIMV2"
Dim query As String = "Select * from Win32_Printer"
Const DefaultPrinter As String = "SetDefaultPrinter"
Const ReturnValue As String = "ReturnValue"

' Fehlerüberwachung einschalten
Try
Dim Printers As New ManagementObjectSearcher(scope, query)
For Each Printer As ManagementObject In Printers.Get()
Dim PrinterDescription As String = _
DirectCast(Printer.GetPropertyValue("Name"), String)
' Vergleichsvariable deklarieren und initialisieren
Dim Compared As Integer = String.Compare( _
PrinterDescription, PrinterName, True)
' Übergebenen Drucker mit vorhandenen Druckern vergleichen.
' Stimmt der übergebene Drucker mit dem Vergleich überein
' wird der übergebene Drucker...
If Compared = 0 Then
' ... als Standarddrucker systemweit gesetzt
Dim mbo As ManagementBaseObject = _
Printer.InvokeMethod(DefaultPrinter, Nothing, Nothing)
' Ist das Rückgabeergebnis = 0 gibt die Funktion...
If CType(mbo.Properties(ReturnValue).Value, Int32) = 0 Then
' True zurueck
Return True
End If
End If
Next
Catch ex As Exception
' Eventuell auftretenden Fehler abfangen
' Fehlermeldung ausgeben
MessageBox.Show(ex.Message.ToString(), "Info")
End Try
Return False
End Function

'''
''' Ausgabe eines Hinweises ob der Vorgang erfolgreich war
'''

Public Shared Sub OutPutMessage(ByVal State As Boolean)
Dim sMsg As String = ""
Select Case State
Case True
sMsg = "Der ausgewählte Drucker wurde gesetzt."
Case Else
sMsg = "Der ausgewählte Drucker konnte nicht gesetzt werden."
End Select
MessageBox.Show(sMsg, "Info")
End Sub
End Class

' alle verfügbaren Drucker anzeigen
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

' Button deaktivieren
Button1.Enabled = False

' Fehlerüberwachung einschalten
Try
' Sanduhr einblenden
Me.Cursor = Cursors.WaitCursor

' StringCollection deklarieren und initialisieren
Dim sc As StringCollection = Printers.GetPrinters()

' Enthält die StringCollection Daten dann...
If sc IsNot Nothing Then
' ... StringCollection in einer Schleife durchlaufen...
For Each Printer As String In Printers.GetPrinters()
' und die Einträge an die ListBox übergeben
ListBox1.Items.Add(Printer)
Next
' Zum Testen eines nicht vorhandenen Drucker...
ListBox1.Items.Add("(Fehler Drucker - zum Testen)")
Else
' Enthält die StringCollection keine Daten, Hinweis anzeigen
Me.Cursor = Cursors.Default
MessageBox.Show("Es konnten keine Drucker ermittelt werden.", "Info")
End If
Catch ex As Exception
' Eventuell auftretenden Fehler abfangen und Hinweis anzeigen
Me.Cursor = Cursors.Default
MessageBox.Show(ex.Message.ToString(), "Info")
End Try

' Standard-Mauszeiger wiederherstellen
Me.Cursor = Cursors.Default

' Button wieder aktivieren
Button1.Enabled = True
End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

' Button für "Standard-Drucker setzen" aktivieren/deaktivieren
Button2.Enabled = (ListBox1.SelectedIndex >= 0)
End Sub

' Ausgewählten Drucker systemweit als neuen Standard-Drucker setzen
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click

' Fehlerueberwachung einschalten
Try
' Dieses Beispiel läuft ab Windows XP. Daher wird zunächst
' das verwendete Betriebssystem geprüft
If Not OS.IsWindowsXPOrHigher Then
MessageBox.Show("Das Beispiel wird erst ab Windows XP unterstützt!", "Info")
Exit Sub
Else
' ChangePrinter mit neuem Drucker aufrufen...
Dim bResult As Boolean = SetPrinter.ChangePrinter( _
Me.ListBox1.SelectedItem.ToString())
' ... und eine Meldung über den Status des Vorgangs ausgegeben
SetPrinter.OutPutMessage(bResult)
End If
Catch ex As Exception
' Eventuell auftretenden Fehler abfangen und Hinweis anzeigen
MessageBox.Show(ex.Message.ToString(), "Info")
End Try
End Sub

End Class

Management information system(VB.NET)

Management information system(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Management information system.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Stop watch (VB.NET)

Stop watch (VB.NET)

Version: VB.NET 2003
Compatibility: VB.NET 2003, VB 2005
Category: Miscellaneous

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple stopwatch.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Drag & Drop - Move files from desktop to a textbox(vb.net)

Drag & Drop - Move files from desktop to a textbox(vb.net)

Version: VB 2005
Compatibility: VB.NET 2002, VB.NET 2003, VB 2005, VB 2008
Category: File Manipulation

This example moves any files from desktop to a textbox. The example needs a reference to Shell32.dll

Declarations:
Imports Shell32
Imports System.IO.Path

Code:
Public Class Form1

Private Structure FileFormat
Public TypeFormat As String
End Structure

Private ff As New FileFormat

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
With Me
.CenterToScreen()
.TextBox1.AllowDrop = True
.ff.TypeFormat = "FileNameW"
End With
End Sub

Private Function DragAndDrop_MoveLink(ByVal Filename As String) As String
Const Filetype As String = ".lnk"
If String.Compare(GetExtension(Filename), Filetype, True) <> 0 Then Return Filename
Dim shell As Shell32.Shell = New Shell32.Shell
Dim DirectoryName As Shell32.Folder = shell.NameSpace(GetDirectoryName(Filename))
Dim Item As Shell32.FolderItem = DirectoryName.Items().Item(GetFileName(Filename))
Dim LinkObject As Shell32.ShellLinkObject = CType(Item.GetLink, Shell32.ShellLinkObject)
Return LinkObject.Path
End Function

Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
Handles TextBox1.DragDrop
If ff.TypeFormat = Nothing Then
Throw New Exception("Error...")
Else
If e.Data.GetDataPresent(ff.TypeFormat, False) Then
Dim Filename As System.Array = CType(e.Data.GetData(ff.TypeFormat, False), System.Array)
TextBox1.Text = DragAndDrop_MoveLink(CType(Filename.GetValue(0), String))
End If
End If
End Sub

Private Sub TextBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _
Handles TextBox1.DragOver
If ff.TypeFormat = Nothing Then
Throw New Exception("Error...")
Else
If e.Data.GetDataPresent(ff.TypeFormat, False) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End If
End Sub

End Class

Get the % of cpu usage of a running thread (VB.NET)

Get the % of cpu usage of a running thread (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Miscellaneous

To watch cpu usage from within the thread to be watched:

Dim CPUutil As New ThreadCPUusageWatcher
Dim PercentUsage as Short
CPUutil .Start()

' Use:
CPUutil..NativeThreadID ' to get the id if the current thread, or set the id of the thread to be watched.

PercentUsage = CPUutil .CPUusage ' to get the current percentage of cpu use of the watched thread

To watch the cpu usage of background threads from another (the main?) thread:
declare CPUutil public, and then set it new from with the thread to be watched. Ie:

Public CPUutil as ThreadCPUusageWatcher

' Then, from within the thread to be watched:
CPUutil = New ThreadCPUusageWatcher
CPUutil.Start()

' CPUutil.CPUusage can then be called from any thread.

' Call:
CPUutil.StopWatcher() ' to stop the watcher when your app closes.

Declarations:
Imports System.Diagnostics
Imports System.Threading

Code:
Public Class ThreadCPUusageWatcher

' This class is used to get the % of cpu usage of a running thread by native thread id.
' It's a great way to be able to tell which thread is hammering your cpu. Usage:
' To watch cpu usage from within the thread to be watched:

' Dim CPUutil As New ThreadCPUusageWatcher
' Dim PercentUsage As Short
' CPUutil .Start()

' Use:
' CPUutil..NativeThreadID ' to get the id if the current thread, or set the id of the thread to be watched.

' PercentUsage = CPUutil.CPUusage ' to get the current percentage of cpu use of the watched thread

' To watch the cpu usage of background threads from another (the main?) thread:
' declare CPUutil public, and then set it new from with the thread to be watched. Ie:

' Public CPUutil As ThreadCPUusageWatcher

' Then, from within the thread to be watched:
' CPUutil = New ThreadCPUusageWatcher
' CPUutil.Start()

' CPUutil.CPUusage can then be called from any thread.

' Call:
' CPUutil.StopWatcher() ' to stop the watcher when your app closes.

Private threadID As Int16
Private WatcherRunning As Boolean = False
Private th1 As Thread
Private Percentage As Long

Public Sub New()
threadID = AppDomain.GetCurrentThreadId
End Sub

Public Sub New(ByVal NativeThreadID As Int16)
threadID = NativeThreadID
End Sub

Private Function GetCurrentNativeThreadID() As Int16
GetCurrentNativeThreadID = AppDomain.GetCurrentThreadId
End Function

' Set the native ID of a process thread to be watched, or get your native thread id
Public Property NativeThreadID() As Int16
Get
Return GetCurrentNativeThreadID()
End Get
Set(ByVal value As Int16)
threadID = value
End Set
End Property
Public ReadOnly Property IsRunning() As Boolean
Get
Return WatcherRunning
End Get
End Property

Public ReadOnly Property CPUusage() As Long
Get
Return Percentage
End Get
End Property

Public Sub StopWatcher()
WatcherRunning = False
End Sub
Public Sub Start()
th1 = New System.Threading.Thread(AddressOf StartWatcher)
th1.Start()
End Sub
Private Sub StartWatcher()
Dim tx As System.Diagnostics.ProcessThreadCollection
Dim t, tId, a, a1, a2, a3, a4, a5, CPUs As Int16
Dim CPUtimeEnd, CPUtimeStart As Double

CPUs = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS")

tx = System.Diagnostics.Process.GetCurrentProcess().Threads
tId = 0

For t = 0 To tx.Count - 1
If tx.Item(t).Id = threadID Then
tId = t
End If
Next

If tId = 0 Then
MsgBox("Thread could not be found.")
Exit Sub
End If

WatcherRunning = True

Try
Do While WatcherRunning = True

CPUtimeStart = tx.Item(tId).TotalProcessorTime.Milliseconds
Thread.Sleep(200)
CPUtimeEnd = tx.Item(tId).TotalProcessorTime.Milliseconds

If (CPUtimeEnd > CPUtimeStart) Or (CPUtimeEnd = CPUtimeStart) Then

a = a + 1
If a = 1 Then
a1 = CPUtimeEnd - CPUtimeStart
ElseIf a = 2 Then
a2 = CPUtimeEnd - CPUtimeStart
ElseIf a = 3 Then
a3 = CPUtimeEnd - CPUtimeStart
ElseIf a = 4 Then
a4 = CPUtimeEnd - CPUtimeStart
ElseIf a = 5 Then
a5 = CPUtimeEnd - CPUtimeStart
ElseIf a > 5 Then
a = 1
End If

Percentage = ((a1 + a2 + a3 + a4 + a5) / 5) / 2
Percentage = Percentage / CPUs
If Percentage > 100 Then Percentage = 100
End If

Loop
Catch ex As Exception
MsgBox(ex.Message)
End Try

WatcherRunning = False
End Sub

End Class

Deactivate or Reactivate the Task Manager(VB.NET)

Deactivate or Reactivate the Task Manager(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Windows Registry

This example deactivates or reactivates the Windows Task Manager. The example needs two buttons: Button1 and Button2.

Declarations:
Option Explicit On
Option Strict On

Imports Microsoft.Win32


Code:
Public Class Form1

Private Structure RegistryValue
Public Path As String
Public Value As String
End Structure

Private rv As RegistryValue = New RegistryValue()

Private ReadOnly Property OpenRegistryKeyForWriting() As RegistryKey
Get
Const Path As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
Return Registry.CurrentUser.OpenSubKey(Path, True)
End Get
End Property

Private Sub EnableDisableTaskmanager(ByVal Index As String)
Dim hKey As RegistryKey = Nothing
Try
Select Case Index
Case "Disabled"
hKey = Me.OpenRegistryKeyForWriting()
If hKey Is Nothing Then
hKey = Registry.CurrentUser.CreateSubKey(rv.Path)
hKey.SetValue(rv.Value, 1, RegistryValueKind.DWord)
Else
hKey = Registry.CurrentUser.CreateSubKey(rv.Path)
hKey.SetValue(rv.Value, 1, RegistryValueKind.DWord)
End If
Case "Enabled"
hKey = Me.OpenRegistryKeyForWriting()
If hKey IsNot Nothing Then
hKey = Registry.CurrentUser.CreateSubKey(rv.Path)
hKey.SetValue(rv.Value, 0, RegistryValueKind.DWord)
End If
End Select
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Info")
Finally
If hKey IsNot Nothing Then
hKey.Close()
End If
End Try
End Sub

Private Function OSVersion() As Boolean
If System.Environment.OSVersion.Platform = PlatformID.Win32NT = True Then
Return True
Else
Return False
End If
End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
If Me.OSVersion = False Then
MessageBox.Show("This example works only under WinNT or higher...", "Info")
Application.Exit()
End If
Me.CenterToScreen()
With Me.rv
.Path = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
.Value = "DisableTaskMgr"
End With
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Me.EnableDisableTaskmanager("Disabled")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
Me.EnableDisableTaskmanager("Enabled")
End Sub

End Class

Random number generator (VB.NET)

Random number generator (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Mathematics

Grabs a random number between two designated, or user input designated numbers. VB.NET

Declarations:
In the instance i have used this, Low is a variable set by the program, not the user. High is based on user input. To allow the user to choose also the low number, just edit and follow the basis for High.

HighNum is a Textbox
Number is a label, in the program i started with this label hidden until the number is generated.

Get_random is the number generated itself. How it works speaks for itself.

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Low As Integer = 1
Dim High As Integer
High = HighNum.Text
Get_Random(Low, High)
Number.Visible = True
Beep()
End Sub

Sub Get_Random(ByVal Low As Integer, ByVal High As Integer)

Number.Text = Math.Floor((High - Low + 1) * Rnd() + Low)

End Sub

Kross Web Browser (VB.NET)

Kross Web Browser (VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Internet Programming


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


A basic web browser with few added features. All basics work, and some extras, but not many. No garuanteed updates to come, do with it as you please.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Graphical Bytes Reader (VB.NET)

Graphical Bytes Reader (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Graphics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Graphical Bytes Reader.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple DataBase Management on VB.NET

Simple DataBase Management on VB.NET

Version: VB 2005
Compatibility: VB 2005
Category: Databases


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


1. This is simple Software for Managing the simple database of the Microsoft Access (OLEDB).
2. It will be very useful for beginners to learn about Database (OLEDB).
3. It is developed on .NET framework2.0 using the .NET language VB.NET


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Read Data From Excel Sheet(VB.NET)

Read Data From Excel Sheet(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Miscellaneous

Get Data From Excel Sheet To Datagridview.

This Is Simple Code..

Declarations:
Imports System
Imports System.Data
Imports System.Data.Odbc


Code:
Public Class FormTest

'create odbc connection object with WithEvents Feature
Private WithEvents con As Odbc.OdbcConnection
'Create odbc command object
Private com As Odbc.OdbcCommand
'Create odbc datareader object
Private rdr As Odbc.OdbcDataReader

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Create the odbc connection object instance and set the connectionstring
' ------ here I created DSN.
con = New Odbc.OdbcConnection("Dsn=MyTestWorkBook")
'Open the connection object
con.Open()

'Create the odbc command object instance
com = New Odbc.OdbcCommand()
With com
'Set the active connection to the command
.Connection = con
'Set the command type
.CommandType = CommandType.Text
'Set the SQL statement
.CommandText = "SELECT * FROM [Employees$]"
'set the datareader object
rdr = .ExecuteReader()
End With

Me.Cursor = Cursors.WaitCursor

'Clear the datagridview control before populate
DataGridView1.Rows.Clear()

'Loop the data until finds EOF
While rdr.Read()
If rdr.GetValue(0).ToString().Trim().Length <> 0 Then
With DataGridView1
'Create the Empty Row
.Rows.Add()
'Set the Value for first coloumn
DataGridView1.Rows((DataGridView1.Rows.Count - 1)).Cells(0).Value = rdr.GetValue(0).ToString()
'Set the Value for second coloumn
DataGridView1.Rows((DataGridView1.Rows.Count - 1)).Cells(1).Value = rdr.GetValue(1).ToString()
'Set the Value for third coloumn
DataGridView1.Rows((DataGridView1.Rows.Count - 1)).Cells(2).Value = rdr.GetValue(2).ToString()
End With
End If
End While
'After execute close the datareader object
rdr.Close()

Me.Cursor = Cursors.Default

'Cancel and Dispose the command object
com.Cancel()
com.Dispose()

'Close and Dispose the connection object
con.Close()
con.Dispose()

'After done everything, display the message box to the user end
MessageBox.Show("Done")

End Sub
Private Sub con_StateChange(ByVal sender As Object, ByVal e As System.Data.StateChangeEventArgs) Handles con.StateChange

'if connection object change the event, user can get capture from this code.
Me.Text = "Read Excel Sheet :- " + e.CurrentState.ToString()

End Sub

End Class

SQL Server Backup Utility(VB.NET)

SQL Server Backup Utility(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


With this utility you can make .mdf backup and restore backup from an VB 2005 application. You can add this tool to your project. I want a partner to add some stuff to this utility please email me.



CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Payroll Information System(VB.NET)

Payroll Information System(VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Databases


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE



Payroll information system displays the information of employee details, salary generation, yearwise salary details, monthwise salary details, yearly salary reports in crystal report. The project contains two tables in ms-access emp_details, emp_payslip.




CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Airline Information System(VB.NET)

Airline Information System(VB.NET)

Version: VB 2005
Compatibility: VB 2005, VB 2008
Category: Databases


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


Airline Information system is a project related to different airline systems in the world. This project features general enquiry about flights, ticket reservation, payment details, reservation status, ticket cancellation, ticket refund while cancellation. This project shows record handling of flights like air india, singapore airlines, cathay pacific, etc. and destinations like new york, tokyo, los angeles, san fransisco, london and many more to and from.

This project is developed totally in vb.net 2005 with backend ms-access.



CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Clear VS2005 Unwated Regvalues(VB.NET)

Clear VS2005 Unwated Regvalues(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Windows Registry

Clear VS2005 Unwanted Reg values.

Declarations:
Imports System
Imports Microsoft.Win32

'Developer :- Gehan Fernando
'Date :- 01-Dec-2008
'Description :- Reset VS2005 Registry Keys

Code:
Public Class FormMRU

'Creeate RegistryKey type variable
Private _regkey As RegistryKey

Private Sub TimerMRU_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerMRU.Tick

'Set system time to LabelTime
LabelTime.Text = Now.ToString("hh:mm:ss tt")

End Sub

Private Sub FormMRU_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Call the TimerMRU control Tick event
TimerMRU_Tick(sender, e)

End Sub

Private Sub ButtonReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonReset.Click

'Delete FileMRUList Sub Key From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0", True)
_regkey.DeleteSubKey("FileMRUList", True)
_regkey.CreateSubKey("FileMRUList", RegistryKeyPermissionCheck.Default)
_regkey.Close()

'Delete ProjectMRUList Sub Key From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0", True)
_regkey.DeleteSubKey("ProjectMRUList", True)
_regkey.CreateSubKey("ProjectMRUList", RegistryKeyPermissionCheck.Default)
_regkey.Close()

'Delete Recent Reference Keys From The Registry
_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0\ComponentPickerPages", True)
_regkey.DeleteSubKeyTree("Recent")
_regkey.CreateSubKey("Recent", RegistryKeyPermissionCheck.Default)
_regkey.Close()

_regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\8.0\Find", True)
Dim valueCollection() As String = _regkey.GetValueNames()
'Sort the result
Array.Sort(valueCollection)

Dim len As Int16 = 0
For Each Item As String In valueCollection
len = Item.Trim.Length
If (Item.Substring(0, len) = "Find" Or Item.Substring(0, len).Contains("Find ")) Or _
(Item.Substring(0, len) = "Replace" Or Item.Substring(0, len).Contains("Replace ")) Then
Debug.Print(Item)
_regkey.DeleteValue(Item)
End If
Next
_regkey.Close()


If My.Computer.FileSystem.DirectoryExists(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files") Then
My.Computer.FileSystem.DeleteDirectory(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files", _
FileIO.DeleteDirectoryOption.DeleteAllContents)
My.Computer.FileSystem.CreateDirectory(Environment.GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Visual Studio 2005\Backup Files")
End If

MessageBox.Show("Registry Clean.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)

_regkey = Nothing

End Sub

End Class

Automatic and mouse controls resizing (and moving)(VB.NET)

Automatic and mouse controls resizing (and moving)(VB.NET)

Version: VB 2005
Compatibility: VB 2008
Category: Controls


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Automatic and mouse controls resizing (and moving), Add resizable controls into Form titlebar and scroll or flash form caption.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Learn 3Tier Architect Application(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Databases


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


This Code is for .net Beginners Willing To Learn 3Tier Application. This Sample Explain How To Use Data Access Layer, Business Object Layer And Presentation Layer. This Application Includes "Insert, Update, Delete, Search and List Collection Techniques" Using 3Tier.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

A Class Room Management program(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Databases

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

A Class Room Management program - almost complete. Add Students, Take Register, Tests, Graphs, Setup of Program, Search students, Textbooks, Photos of students, Print Various reports. This is created for a College or school.
Try this and tell me what you think...


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Simple Brain Game(VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Mathematics

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE


Arranging the tiles that are specified with the numbers.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Sunday, January 4, 2009

Passing Parameters in ASP.NET

Version: ASP.NET 1.0
Compatibility: ASP.NET 1.0
Category: ASP.NET


I'm frequently asked how to pass parameters from one page to another page in ASP.NET.

This is a beginner's question and every ASP.NET developer should master this concept. So if you don't already know the answer, then definitely read on...

I get asked this alot as our charting tool is implemented via two web pages. One web page has a server chart control that renders as HTML (either an IMG or CLSID object tag.) The second page has a server control that streams the bits constituting the object created via HTML from the first page. This process is ideal for web-farm environments as it's purely scaleable.

To help visualize the problem. Take a look at www.gigasoft.com/financial.aspx

On the left hand side of chart the user can select a stock symbol to load the corresponding stock data.

To implement such a site...

Declarations:
'none

CODE:
'Within the Page_Load for the form1 (Financial.aspx.cs)

// Add a parameter to pass volume checkbox data
string s = "";
if (VolumeCheckbox.Checked == true)
s = s + "Volume=1";
else
s = s + "Volume=0";

// Add a parameter to pass symbol combobox data
s = s + "&Symbol=" + SymbolComboBox.Value.ToString();

PegoWeb1.ImageUrl = "Financial2.aspx?" + s;


Within the Page_Load of the form2.
string sVolume;
string sSymbol;
sVolume = this.Request.QueryString.Get("Volume");
sSymbol = this.Request.QueryString.Get("Symbol");


Note the "?" at end of ImageUrl = "Financial2.aspx?".
Note you can string together multiple parameters separating with "&" symbol.

Create Dynamic Header Footer with XML in asp.net

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.1
Category: ASP.NET


There are various approaches for creating header and footer for a site.

Most of the time there is a mode of creating a static menu for header and footer. Time comes when looking at the same menu over and over again bores a user or at least the client. Why not give the client a menu where he can have fun and can make changes the way he wants?

There are almost countless methods of creating a dynamic menu and displaying it on our presentation layer. JavaScript, DHTML, XML and many other scripts come to our aid for creating a menu for header and footer. Being an ASP person, I have tried to create a menu using ASP.net (C#) and XML that is easily understandable and handy too. I came across a header/footer sample on the net that allowed you to add the menu to your page without having to add any ascx control. This inspired me to create this sample application that can do the thing without ascx.

Using the code
Unzip the files to a folder named HeaderFooter. Create a virtual directory with your IIS named HeaderFooter. In your browser open the page using following address: http://localhost/HeaderFooter/index.aspx You will find three class files that are responsible for this beautiful menu work.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Executing SQL Server stored procedures with ASP.NET

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.1
Category: ASP.NET


Level: Beginner to intermediate

The zip file contains an ASP.NET page that demonstrates how to execute a stored procedure to add a user to a SQL Server database. The file also contains two sql scripts to create the sample user table & stored procedure used by the web page.

ReadMe.txt contains instructions & a url directions to the full demo text...


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

WorkFlow Management System (asp.net)

Version: ASP.NET 1.0
Compatibility: ASP.NET 1.0, ASP.NET 1.1
Category: ASP.NET


Workflow Management System is a general purpose system used to configure a workflow and used the configured workflow. This application can be used for any general purpose and very useful for organization. It has two modules: Manager module and User module. Manager configure the workflow and user uses it. workflow contains stages and stages contains tasks in the form of Textbox, Checkbox, Dropdown etc. Manager asign users to each stage. Please mail me for any suggestion or help.

CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

ASP.NET DB Admin Control

Version: ASP.NET 1.0
Compatibility: ASP.NET 1.0, ASP.NET 1.1
Category: ASP.NET


This is a small Web Application, this contains basic database functions using ASP.NET including a database driven user authentication, adding new records, viewing records, editing and deleting records.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Web School (Student & Teacher) Online SP(asp.net)

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.0, ASP.NET 1.1
Category: ASP.NET


This is "Web School (Student & Teacher) Online SP" application made with ASP.NET (VB.NET 2003) and SQL Server 2000. Please download and try it. I hope you can enjoy it.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

World Recipe Directory v2 ASP .NET

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.0, ASP.NET 1.1
Category: ASP.NET


World Recipe v2 is an ASP .NET application and an Access Database to contain and display recipes in a wide variety of categories, also allow your visitors to post their favorite recipes, rate recipe and add comment. You can edit/delete recipes and comments in a password protected admin recipe manager area.

This application is aim to those who wants to explore and practice/play with ASP .NET without using VS .NET. I wrote this app entirely in notepad just like my other site and use server map path database connection string. To install it, all you have to do is unzipped the file in the root directory, and you're ready to go...Furthermore, this application does not have dll, user control, code-behind, it's written in an in-line code. So if you are a savvy classic ASP coder, you'll never have any problem modifying and running the application in your local PC. There are so many things you can with this application, you can create an article directory, link directory, download and many more...


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Manage Parent-Child Winodw and return value in asp.net

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.1
Category: ASP.NET


Manage Parent-Child Window and return value from Child popup Window and refresh parent (for IE,NS.FF)

In many of our Web projects we have a situation where we have to develop a parent window displaying list of records with an option to add new record or edit the existing one. In such scenario user may be allowed to add or modify the full record in a popup window. After record editing is complete, focus returns to parent window, only if child window in which the record was edited is closed.

Upon receiving the focus, parent window should reflect the changes made to the record and will re-retrieve the data from the server. Parent should re-retrieve the data only if record is modified in the child window else focus should return to the parent.

This example has separate set of code performing the above task for IE6.0 and for NS7.2, browsers. Value 14 is return to parent if button (say Save or OK) is clicked in popup window, to save the record. In this case parent will refresh to display the changes, and if x is clicked to close the child window, parent will not refresh.

Enter any value in the text box and click ‘Open Popup Window’ link. Value is passed to child window and is displayed in the first text box; second text box contains a constant which is passed from the parent. Parent reloads only if OK is clicked in child window.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

asp.net code to show IP Address to Country City ISP & Domain

Version: ASP.NET 1.1
Compatibility: VB6, ASP.NET 1.1
Category: ASP.NET


This is ASP.NET script to enable lookup of country, region, city, latitude, longitude, ISP and domain name from IP address by using IP2Location database. Free sample database available at http://www.ip2location.com.

The script supports several database types such as Microsoft Access, MS SQL and mySQL. Internet geolocation has been widely used in the products or projects below.


1) Select the geographically closest mirror

2) Analyze your web server logs to determine the countries

3) Credit card fraud detection

4) Software export controls

5) Display native language and currency

6) Prevent password sharing and abuse of service

7) Geo-targeting in advertisement


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

asp.net code to Display Help and Error Message in Tool Tip

Version: ASP.NET 1.1
Compatibility: ASP.NET 1.1
Category: ASP.NET


The objective is to display all the error messages at the same time, save unnecessary trip to server and add no additional control or occupy space on page to display the error message.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

ASP.NET Web Page Data Validation - Tool tip based

Version: ASP.NET 1.1
Compatibility: VB6, ASP.NET 1.1
Category: ASP.NET


The objective is to display all the help and error messages at the same
time, save unnecessary trip to server and add no additional control or
occupy space on page to display the error message.


CLICKHERE TO DOWNLOAD SOURCE CODE AND ARTICLE

Source Code for CSV Parsing in .NET

Version: VB.NET 2003
Compatibility: VB.NET 2003, ASP.NET 1.1
Category: ASP.NET


Code for CSV Parsing in .NET.

Declarations:
Imports System
Imports System.IO

CODE:
Module modParseCSV



Public Sub ReadFromFile(ByVal strPath As String)
Dim FileHolder As FileInfo = New FileInfo(strPath)
Dim ReadFile As StreamReader = FileHolder.OpenText()
Dim InputText As String
Dim strLine

Do
strLine = ReadFile.ReadLine
If Not strLine = "" Then
ParseCSV(strLine)
MsgBox("ENDLINE")
Else
ReadFile.Close()
ReadFile = Nothing
End If
Loop Until ReadFile Is Nothing

Return True
End sub


Public Sub ParseCSV(ByVal CSVstr As String)

Dim startPos As Integer
Dim endPos As Integer
Dim currPos As Integer
Dim tempPos As Integer
Dim tempstr As String
Dim commaPos As Integer
Dim quotePos As Integer
Dim strLen As Integer
Dim charLen As Integer

startPos = 1
currPos = 1

strLen = Len(CSVstr)


Do While strLen <> 0
CSVstr = Replace(CSVstr, Chr(34) & Chr(34), "'")
commaPos = InStr(currPos, CSVstr, ",")
quotePos = InStr(currPos, CSVstr, Chr(34))
'last data
If commaPos = 0 Then
If quotePos = 0 Then
If Not currPos > endPos Then
endPos = strLen + 1
charLen = endPos - currPos
tempstr = Mid(CSVstr, currPos, charLen)
'If Not tempstr = "" Then
ReadChars(tempstr, 1, charLen, charLen)
'End If
End If
Else
currPos = quotePos
endPos = InStr(currPos + 1, CSVstr, Chr(34))
charLen = endPos - currPos
tempstr = Mid(CSVstr, currPos + 1, charLen - 1)

'If Not tempstr = "" Then
ReadChars(tempstr, 1, charLen, charLen)
'End If
End If
Exit Do
End If
'no " in line
If quotePos = 0 Then

endPos = commaPos
charLen = endPos - currPos
tempstr = Mid(CSVstr, currPos, charLen)
'If Not tempstr = "" Then
ReadChars(tempstr, 1, charLen, charLen)
'End If


ElseIf (quotePos <> 0) Then
'" in line
If commaPos < quotePos Then
endPos = commaPos
charLen = endPos - currPos
tempstr = Mid(CSVstr, currPos, charLen)
'If Not tempstr = "" Then
ReadChars(tempstr, 1, charLen, charLen)
'End If
Else
currPos = quotePos
endPos = InStr(currPos + 1, CSVstr, Chr(34))
charLen = endPos - currPos
tempstr = Mid(CSVstr, currPos + 1, charLen - 1)

'If Not tempstr = "" Then
ReadChars(tempstr, 1, charLen, charLen)
'End If
endPos = endPos + 1
End If
End If
currPos = endPos + 1
Loop



End sub

Public Function ReadChars(ByVal str As String, ByVal StartPos As Integer, ByVal EndPos As Integer, ByVal strLen As Integer)

Dim strArray As [String] = str
Dim b(strLen) As Char
Dim sr As New StringReader(strArray)

sr.Read(b, 0, EndPos)

MsgBox(b)

sr.Close()
End Function



End Module

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger