?
Solved

convert binary to text(modem)

Posted on 2002-06-19
3
Medium Priority
?
203 Views
Last Modified: 2012-06-27
I'm able to send data thru modem using cominputmodebinary

Dim aryBytes() As Byte
aryBytes = Text1.Text
MSComm1.Output aryBytes

but all i get at the other end are questionmarks.

inbuff= mscomm1.input
msgbox inbuff

even if i dim inbuff as byte the same thing happens.Help! how do i convert the input data to text?
0
Comment
Question by:sudeepn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:Nitin Sontakke
ID: 7092287
I am probably the last person who should post a comment to this but still....

A simple assignment like this won't work. You will need to assign the byte value of each and every character in text1.text. If i am correct, you can do it as follows:

Dim aryBytes() As Byte, intIndex as Integer
Redim aryBytes(Len(Text1.Text))
For intIndex = 1 to Len(Text1.Text)
    aryBytes(intIndex) = CByte(Asc(Mid(Text1.Text, intIndex, 1)))
Next intIndex
MSComm1.Output aryBytes

Again, just Asc() is enough, to achieve it? I don't see any work done by cByte() above.

0
 
LVL 5

Expert Comment

by:Julian_K
ID: 7092289
Hi.
1. Why sending as aryBytes? I mean why do you send data as bytes? Why not send it as string?

2. Have you tried with the "StrConv" function to convert the data from string to binary and vice versa?
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 200 total points
ID: 7092755
Yes, use StrConv.

The problem is that the buffer will contain single byte data, which needs to be converted to unicode data for VB to display it properly.

Dim buffer
buffer = oCommMiu.Input
If Len(buffer) > 0 Then
  strConnect = strConnect & StrConv(buffer, vbUnicode)
End if
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question