Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 - Use of Text Box for 'Real-Time' data Logging-Feasible?

Status
Not open for further replies.

hafod

Technical User
Mar 14, 2005
73
GB
Hi,
Is it possible to use a text box (list box?)to provide an on-screen 'real-time' record of data samples produced by my application. An A-D convertor is sampled every 0.5 sec and I would like to record the 'normalised' 8 bit binary data I have converted to decimal with a system 'time stamp'. Accurately sampling the data is no longer a problem thanks to 'GOLOM's helpful post.

The visual output would be in the format:
data, system time
data, system time
data, system time ...etc.

The scrollable text box would display say the most recent say 10 data / time values. The 'top' record in the list would be the most recent sampled data. But of course the 'height' property of the text box could be adjusted to achieve a sensible displayed record limit.

I can confidently handly multi-dimensional arrays in vb if this is required as part of the solution. I cant however figure out how to create this 'historic visual data log' which needs regular updating. My initial thougths steer me towards 'data bound' type objects and arrays?.

Hope you can offer suggestions.

Hafod
 
We use listboxes for this sort of thing all the time. It works quite well.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi Tracy,
Thank you for your helpful response. Could I ask you to amplify on how you would go about using it in the context of my problem, with perhaps a code example. That would give me a great 'kick-start' to making progress on this issue.
Kind regards and many thanks,
MHafod (Mike)
 
You'll need aform with a Timer and a Listbox for this example
Code:
[blue]Option Explicit
Private Const MaxLogItems = 10

Private Sub Form_Load()
    Timer1.Interval = 1000
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    List1.AddItem Now, 0
    If List1.ListCount = MaxLogItems + 1 Then List1.RemoveItem MaxLogItems
End Sub
[/blue]
 
Hi Tracy,
Very many thanks for code suggestion. Works fine - now extending it.

Incidentally, being Welsh (national emblem, the red dragon 'Y Ddraig Goch'), I cant on this occasion concur with your thought of wisdom!

Best regards,
Mike (Hafod)
 
A.) Tracy's signature doesn't refer to the eating of dragons.

B.) The code suggestion came from strongm.

What a Monday, hmm?
 
Hi,
Yes, apologies are in order here. 'Monday morning syndrome '!!! - seems perpetual at the moment. Thanks strongm. Dragons are a protected species (...in Wales!).

(hwyl) - Bye for now.
Hafod
 

strongm: beat me to it! that's essentially just what we do. (how many ways are there to do it?)

hafod: I consider them a protected species here to. fortunately they don't require a lot of protection, they do a pretty good job of protecting themselves.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top