[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to receive 43 bytes of data from a Microcontroller using MSCOMM in VB 6 and display them onto a vb form ?

Posted on 2004-11-15
Medium Priority
Last Modified: 2013-12-25
I am using VB6 and MSCOMM to create a link between my PC and Microcontroller.

I am sending 43 bytes of data to my Microrcontroller from an array of 43 bytes and writing it to the EPROM of my microcontroller. I wan to be able to read that data later on and display it on a form.

I can successfully receive a byte when a Comm RX event is triggered.

but not sure how to receive all 43 bytes and display them onto a vb form (form text, combo etc controls)

I am sending a query command to microcontroller then it sends me all these byte. I am able to see this data
coming on scope but not able to receive it. Please help ?
Question by:adnansami
  • 2

Expert Comment

ID: 12582424
Try this ...

Private Sub Command1_Click()
   Dim InString As String
   MSComm1.InputLen = 43

   If MSComm1.InBufferCount >= 43 Then
         InString = MSComm1.Input
   End If
End Sub


Author Comment

ID: 12594337
Thanks for the post
I tired it and it did not work ?
What about RThreshold property ? I want to receive all this on a comm event.
How do I parse it and display it onto the controlls

Expert Comment

ID: 12594491
You can try something like this ...

Dim InString As String

private sub Form_Load()
' ....
  MSComm1.InputLen = 43
  MSComm1.RThreshold = 43
' ....
end sub

Private Sub MSComm1_OnComm ()
   Select Case MSComm1.CommEvent
        Case comEvReceive      
               InString = MSComm1.Input
   End Select
End Sub


Accepted Solution

modulo earned 0 total points
ID: 12989102
PAQed with no points refunded (of 75)

Community Support Moderator

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 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…
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 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