Solved

GetData or PeekData and calling a form to display

Posted on 1997-11-04
3
640 Views
Last Modified: 2010-08-05
I have a program that captures data out of the comm port. I also can TELNET to the device  but when I try and invoke the peekData or GetData It see's nothing. I am using another form to display the data back, Could that be the issue? Here is the code out of the books online of the GetData I am using. Is there any good examples of TCP/IP (telnet)programs out there?
 
Private Sub Winsock1_DataArrival_(ByVal bytesTotal As Long)
    Dim strData As String
    Winsock1.GetData strData
    Text1.Text = strData
End Sub

Here is how it is being called.

Private Sub mnuTelnetOpen_Click()
   
   'Winsock1.RemoteHost = "140.248.152.196"
    Winsock1.RemotePort = 23
    'txtTerm.Text = ""
    Winsock1.Connect
    TCPform.Show vbModal
End Sub

Private Sub Winsock1_Connect()
 Dim PauseTime, Start, Finish, TotalTime
 Dim error1, last1
 
    Winsock1.SendData "root" & Chr(13)
    Beep
    Winsock1.SendData Chr(13)
    Winsock1.SendData Chr(13)
    'MSComm1.InputLen = 0 ' Get all available data
    'MSComm1.Handshaking = 1
     
   
       
     If MSComm1.PortOpen = True Then
     
        Winsock1.SendData "ls" & Chr(13)

Thanks in advance for your help.

-S
0
Comment
Question by:smurray
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 100 total points
ID: 1439800
smurray,

When you open a form modally, you stop all processing on the calling form until you return from the modal form.  Therefore, you are not getting your events.  You need to not show the form modally, and some how create a "pseudo-modal" form.  By that I  mean, it's operates like a modal form, but is not really modal.

Anthony
0
 

Author Comment

by:smurray
ID: 1439801
Thanks for the tip on the modalm but I still cannot read back from the device. Is there an example on how to GetData during a Telnet session?
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1439802
what you did looks perfect   I have a telnet OCX of my own, and that's how I made it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now