 |
| 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
|
|
|
|

August 11th, 2010, 01:55 AM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|
|

August 11th, 2010, 08:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
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.
================================================== =========
|
|

August 11th, 2010, 07:48 PM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear gbianchi,
For timer i have do it. But for array label i got problem on that
|
|

August 11th, 2010, 08:22 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
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 ...
|
|

August 16th, 2010, 03:04 AM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
recordset to getrows
Quote:
Originally Posted by Old Pedant
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?
|
|
 |