ASCII to Binary

vbkev

Active member
Joined
Jun 4, 2004
Messages
32
Location
Newcastle, UK
Programming Experience
5-10
do you want to convert a String to a Byte Array, or the Binary Equivelant (01011100 for a character for example) or do you want the Hex values or something else?
 

imdimonique

Member
Joined
Jun 3, 2004
Messages
10
im not sure, heres the thing, im working with a board which is attached to my comport, im using mscomm controls, the board btw only accept binary(10101), when i issue a "10101" string to the board, i doesnt respond.. i guess its still an ascii even tho its 10101, here's the snipet

Dim strCommand As String

MScomm.PortOpen = True

Dim writebuffer() As Byte

Dim sendCommand As Object

Dim intCommand As Int64

Dim encord As New System.Text.ASCIIEncoding

Try

writebuffer = encord.GetBytes("10101" + vbCr)

MScomm.Output = writebuffer

Thread.Sleep(2000)

If MScomm.InBufferCount > 0 Then

TextBox2.Text = MScomm.Input

End If

MScomm.PortOpen = False

Catch ex As Exception

MessageBox.Show(ex.ToString)

End Try

 
Top Bottom