473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Visual Basic 6.0 Timer Issues: Running Multiple Events

I'm currently building a User Interface the launchs dts packages from VB. I am trying to use a timer control to measure elapsed time(time it takes for the dts to run).

Currently the timer will run by itself without triggering the DTS to run. If I want the DTS to run and timer to start and show the elapsed time in a label.caption. How can I get both events to run at the same time.

With the code below. The DTS will run then timer starts running once that package has ran. Help!

Set oPackage = New DTS.Package
oPackage.LoadFromSQLServer "<server>", , , DTSSQLStgFlag_UseTrustedConnection, , , , "<package name>"

'$$$$$$$$$$$$$$$$$$$$$$$$$$ Timer Start $$$$$$$$$$$$$$$$$$$$$$$$$$
Screen.MousePointer = vbHourglass
If Timer1.Enabled = False Then
Timer1.Enabled = True
End If



'$$$$$$$$ Set Exec on Main Thread $$$$$$$$$$
For Each ostep In oPackage.Steps
ostep.ExecuteInMainThread = True
Next

oPackage.Execute
Screen.MousePointer = vbNormal





'Get Status and Error Message
For Each ostep In oPackage.Steps

If ostep.ExecutionResult = DTSStepExecResult_Failure Then
ostep.GetExecutionErrorInfo lErr, sSource, sDesc
sMessage = sMessage & "Step """ & ostep.Name & _
""" Failed" & vbCrLf & _
vbTab & "Error: " & lErr & vbCrLf & _
vbTab & "Source: " & sSource & vbCrLf & _
vbTab & "Description: " & sDesc & vbCrLf & vbCrLf
Else
sMessage = sMessage & "Step """ & ostep.Name & _
""" Succeeded" & vbCrLf & vbCrLf
End If
Next
'$$$$$$$$$$$$$$$$$$$$$$$$$$$ Timer Stop $$$$$$$$$$$$$$$$$$$$$$$$$$$$
'Timer1.Enabled = False
oPackage.UnInitialize

Set ostep = Nothing
Set oPackage = Nothing

' Display Results
MsgBox sMessage
'
Jan 4 '07 #1
3 2364
Killer42
8,435 Expert 8TB
I can't help directly, as I know nothing about DTS (actually, what does it stand for?). But perhaps as a workaround, you could fire off another simple application which would simply display elapsed time, until you kill it.
Jan 4 '07 #2
DTS - Data Transformation Services.. I figured out the problem and now I am looking for resolution. The DTS package and Timer object were trying to run on the same thread. MultiThreading seems to be the fix but I'll have to see. Never created a MultiThreaded app.
Jan 5 '07 #3
Killer42
8,435 Expert 8TB
DTS - Data Transformation Services.. I figured out the problem and now I am looking for resolution. The DTS package and Timer object were trying to run on the same thread. MultiThreading seems to be the fix but I'll have to see. Never created a MultiThreaded app.
Me neither, though I have at least one app which could probably benefit greatly from multiple threads.

Presumably in this piece of code...
Expand|Select|Wrap|Line Numbers
  1. '$$$$$$$$ Set Exec on Main Thread $$$$$$$$$$
  2. For Each ostep In oPackage.Steps
  3.   ostep.ExecuteInMainThread = True
  4. Next
...you can set them not to execute in the main thread.

Let us know how it goes?
Jan 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
16
by: Jesse Liberty | last post by:
I am writing a new book on Visual Basic 2005, targeted at VB6 programmers, and to some degree VB.NET 1.x programmers. I'd like to sign up a (limited) number of volunteers to read the book and...
2
by: r norman | last post by:
Please excuse the cross-posting. This question was raised in microsoft.public.dotnet.general but hasn't been answered so I am trying where I can. There are two of us who have the same problem...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
4
by: Max | last post by:
This may be an elementary question but it's something I have not encountered in about 10 years writing code in VB 5 / 6 I have a timer that using the API checks if there has been a change to one...
8
by: WT | last post by:
Is it normal that Visual Studio sets the PreInit handler for a Page from the OnInit code ? No chance to fire it as OnPreInit is run befor OnInit. ??? CS
1
by: =?Utf-8?B?RHVzdGlu?= | last post by:
I am trying to build a program for the first time in Visual Basic. I work for a public utility and we will use to track our crews during large outages. It is a simple program with 16 lines of text...
0
AHMEDYO
by: AHMEDYO | last post by:
Hi Every one... With this visual Basic 6.0 Code you can handle more event that visual basic Support as Mouse wheel and hover or you can control event before VB IDE Default Windows proc as...
3
by: =?Utf-8?B?Rmxhc2hwcm8=?= | last post by:
i have googled this question but cannot find an answer. i'm running windows vista and i'm using Visual Basic Express 2008. i know the build event button SHOULD be in under the compile tag but i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.