?
Solved

convert binary to text(modem)

Posted on 2002-06-19
3
Medium Priority
?
202 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 9

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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