Solved

convert binary to text(modem)

Posted on 2002-06-19
3
201 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 50 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 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…

690 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