Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AscB from VB 6 to VB.NET

Status
Not open for further replies.

egstatus

Programmer
Joined
Apr 14, 2005
Messages
143
Location
US
Hi I am kind of new to VB.NET

I am converting a vb 6 app to vb.net 2008

'UPGRADE_ISSUE: AscB function is not supported.
for i = 43 to 44
If i = 44 Then
If AscB(bTest1(i)) <> 48 Then
'MsgBox "Batch Out Of Balance"
bOutOfBalance = True
End If
End If
next i

What is the function equivalent in VB.NET to AscB? or how do I do this in vb.net 2008?
bTest1 is a byte array that contain a file that was open in banary mode.

Thanks in advance

Ed
 
Look at the functions in the System.Text.Encoding.ASCII namespace.
 
Try this:

[red]Dim ByteArray() As Byte[/red]

for i = 43 to 44
If i = 44 Then
[red]'Convert string to byte array
ByteArray= System.Text.ASCIIEncoding.ASCII.GetBytes(bTest1(i))[/red]

[red]'check first byte in array, like AscB[/red]
If [red]ByteArray(0)[/red] <> 48 Then
'MsgBox "Batch Out Of Balance"
bOutOfBalance = True
End If
End If
next i


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top