Calculating Checksum from VB

Imported from previous forum

Can anyone tell me how to calculate the checksum value from vb.

Thanks in advance

Robert

[ original email was from Keith R Kennedy - keith.kennedy@wdr.com ]
> Can anyone tell me how to calculate the checksum value from vb.
>

Try this:

Start a new VB Standard project.
Add a command button and two text boxes to the form.
Paste this code into the code section of the form:

Private Sub Command1_Click()
Dim i As Integer
Dim Tot As Long
For i = 1 To Len(Text1.Text)
Tot = Tot + Asc(Mid(Text1.Text, i, 1))
Next i
Text2.Text = Tot Mod 256
End Sub

Press F5 to run the program.
Enter a string into Text1, click the command button and Text2 will contain your checksum.