Sephozzy
August 16th, 2001, 03:43 AM
I have the following code:
private Sub cmdLink_Click()
on error GoTo ErrorHandler
Dim Source as string
cdlGetFile.DialogTitle = "Link Database"
cdlGetFile.InitDir = App.Path
cdlGetFile.Filter = "database|link.mdb"
cdlGetFile.ShowOpen
Source = cdlGetFile.FileName
ImportCPLink Source
Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical, "error"
Exit Sub
End Sub
...
private Sub ImportCPLink(Source as string)
set dbsLink = OpenDatabase(Source)
set rstCompany = dbsLink.OpenRecordset("COMPANY", dbOpenForwardOnly)
Do While Not rstCompany.EOF
' do all sorts of stuff
rstCompany.MoveNext
Loop
rstCompany.Close
dbsLink.Close
End Sub
Everything works fine BUT (there's always a but) my window isn't updated while the program is processing the while loop. Since I'm fairly new to VB I don't know a way to put the processing in the background or another way to update the GUI.
Please help out a C++ programmer who is stuck with VB for now. Just as I rate answers in the VCC forums I will rate yours if it helps ;-)
private Sub cmdLink_Click()
on error GoTo ErrorHandler
Dim Source as string
cdlGetFile.DialogTitle = "Link Database"
cdlGetFile.InitDir = App.Path
cdlGetFile.Filter = "database|link.mdb"
cdlGetFile.ShowOpen
Source = cdlGetFile.FileName
ImportCPLink Source
Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical, "error"
Exit Sub
End Sub
...
private Sub ImportCPLink(Source as string)
set dbsLink = OpenDatabase(Source)
set rstCompany = dbsLink.OpenRecordset("COMPANY", dbOpenForwardOnly)
Do While Not rstCompany.EOF
' do all sorts of stuff
rstCompany.MoveNext
Loop
rstCompany.Close
dbsLink.Close
End Sub
Everything works fine BUT (there's always a but) my window isn't updated while the program is processing the while loop. Since I'm fairly new to VB I don't know a way to put the processing in the background or another way to update the GUI.
Please help out a C++ programmer who is stuck with VB for now. Just as I rate answers in the VCC forums I will rate yours if it helps ;-)