Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2010, 01:55 AM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default vb6 recordset

I have 4 label which is the record take out from database order by Date.
After 2 second the data always move example data on 1st record become data on 2nd record. Sample as below(if got 5 records):-

data1
data2
data3
data4

after 2 second

data2
data3
data4
data5

after 2 second

data3
data4
data5
data1

after 2 second

data4
data5
data1
data2

how to do that using vb6?

Last edited by omel; August 11th, 2010 at 02:37 AM..
 
Old August 11th, 2010, 08:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello there.. You need to use a timer that executes every 2 seconds to make the move by yourself.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old August 11th, 2010, 07:48 PM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear gbianchi,

For timer i have do it. But for array label i got problem on that
 
Old August 11th, 2010, 08:22 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Don't use a new query each time. Use ADODB.Recordset.GetRows() to convert the recordset into an array and then just "rotate" the array every 2 seconds.

Code:
Set RS = conn.Execute( ... )
Dim data
data = RS.GetRows( )
Then, to display the data you just do
Code:
For row = 0 To 3 ' to show first 4 rows
    item1 = data(0,row)
    item2 = date(1,row)
    ... display the items ...
Next ' next row
' then ROTATE the array:
For col = 0 To UBound(data,1)
    temp = data( col, 0 )
    For row = 0 To UBound(data, 2)
        data( col, row ) = data( col, row + 1 )
    Next ' row
    data( col, UBound(data,2) ) = temp
Next ' col
... then use the timer to wait 2 seconds and repeat all of this block ...
 
Old August 16th, 2010, 03:04 AM
Registered User
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default recordset to getrows

Quote:
Originally Posted by Old Pedant View Post
Don't use a new query each time. Use ADODB.Recordset.GetRows() to convert the recordset into an array and then just "rotate" the array every 2 seconds.

Code:
Set RS = conn.Execute( ... )
Dim data
data = RS.GetRows( )
Then, to display the data you just do
Code:
For row = 0 To 3 ' to show first 4 rows
    item1 = data(0,row)
    item2 = date(1,row)
    ... display the items ...
Next ' next row
' then ROTATE the array:
For col = 0 To UBound(data,1)
    temp = data( col, 0 )
    For row = 0 To UBound(data, 2)
        data( col, row ) = data( col, row + 1 )
    Next ' row
    data( col, UBound(data,2) ) = temp
Next ' col
... then use the timer to wait 2 seconds and repeat all of this block ...

Dear Old Pedant,

Your thing is a what i want. Thanks. But when reach on this row 'Data(Col, Row) = Data(Col, Row + 1) error --> subscript out of range. Why this problem happend?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Vb6 access 97 recordset problem Probie VB Databases Basics 3 August 1st, 2007 06:12 PM
Database Printing Recordset VB6 Hondacars VB How-To 1 March 11th, 2006 06:15 AM
VB6 ComboBox Source from Recordset tsehenuk VB Databases Basics 3 April 12th, 2005 04:41 PM
VB6 database ADO recordset error tsehenuk Beginning VB 6 12 January 31st, 2005 07:33 PM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.