|
-
Mar 11th, 2003, 12:38 PM
#1
Thread Starter
Lively Member
Timer Control
I am using VB6 and I want a flash movie to play while showing a message while my database looks up the userid and password codes. Problem is... the database is too small and my flash doesn't get shown. I want to know how I can delay (like 2 seconds ) so I can show that flash doc before it begins looking up in the database. I need some sort of timer control that is triggered by the clicking of the submit button so the user knows that the information is being verified. Thanks on avance!
-
Mar 11th, 2003, 12:41 PM
#2
Thread Starter
Lively Member
Sorry
Please excuse the typing... as I am extemely tired!
-
Mar 11th, 2003, 02:01 PM
#3
Member
Display your flash movie on a seperate thread and explicity force the thread to sleep for 2 seconds after calling the db:
Code:
using System;
using System.Threading;
class ShowFlash {
static void Main() {
Thread t = new Thread(new ThreadStart(DisplayFlash));
t.Start();
RetrieveDBInfo();
t.Abort();
}
static void DisplayFlash() {
Console.WriteLine("Display Flash Movie Here..");
}
static void RetrieveDBInfo() {
// Retrieve information from db
Thread.Sleep(2000);
}
}
-
Mar 11th, 2003, 02:17 PM
#4
Sleep mode
Re: Timer Control
Originally posted by BurnMan2003
I am using VB6 and I want a flash movie to play while showing a message while my database looks up the userid and password codes. Problem is... the database is too small and my flash doesn't get shown. I want to know how I can delay (like 2 seconds ) so I can show that flash doc before it begins looking up in the database. I need some sort of timer control that is triggered by the clicking of the submit button so the user knows that the information is being verified. Thanks on avance!
If you want to make use of threading , SimonVega got a good example otherwise , paste a timer control , disable it , and fire it after the user fill in empty spaces .
timer1.interval = 2000
timer1.enabled =true
-
Mar 11th, 2003, 02:18 PM
#5
Sleep mode
the code should go inside a button the user will click !
-
Mar 11th, 2003, 02:26 PM
#6
Member
the code should go inside a button the user will click !
Thanks for the clarification...
-
Mar 11th, 2003, 03:02 PM
#7
Thread Starter
Lively Member
OK
Will this work in VB6, because it looks like c++ coding with the braces!
-
Mar 11th, 2003, 03:08 PM
#8
Thread Starter
Lively Member
Flash
OK when the user fills in the userid and the password, they click on the submit. I then want the flash movie that says "Validating" to appear and run.. but the database is too small for it to play because it finds the data too fast. How can I from The submit button in VB6 get that flash movie to play for 2 or 3 seconds and then search the database? Thaks, I hope ths is clearerr.... here is the code I have so far under the command button:
Private Sub cmdSubmit_Click()
' Validate Inputs
On Error GoTo Err_Check
Dim strsql As String
strsql = "Select * FROM tblUsers Where UserName = '" & txtUserName.Text & "'"
flaVerify.Visible = True
cmdSubmit.Enabled = False
Set rst = New ADODB.Recordset
rst.Open strsql, cnn, adOpenForwardOnly, adLockReadOnly
If Not rst.EOF And Not rst.BOF Then
If rst!Password = txtPwd.Text Then
frmSwitch.Show
Me.Hide
Else
flaVerify.Visible = False
MsgBox "Invalid Password"
cmdSubmit.Enabled = True
End If
Else
flaVerify.Visible = False
MsgBox "Invalid User Name"
cmdSubmit.Enabled = True
End If
rst.Close
Exit_Check:
Set rst = Nothing
Exit Sub
Err_Check:
MsgBox Err.Description, "Login Function"
Resume Exit_Check
End Sub
-
Mar 11th, 2003, 03:16 PM
#9
Member
Just noticed you mentioned VB6...This is a .NET Forum.
The code I posted is in C#. Here is a VB.NET equivalent:
Code:
Imports System
Imports System.Threading
Public Module Module1
Sub Main()
Dim t As New Thread(AddressOf ShowFlash.DisplayFlash)
t.Start()
ShowFlash.CallDB()
t.Abort()
End Sub
End Module
Public Class ShowFlash
Public Shared Sub DisplayFlash()
Console.WriteLine("Display Flash...")
End Sub
Public Shared Sub CallDB()
Console.WriteLine("Call DB")
Thread.Sleep(2000)
End Sub
End Class
-
Mar 11th, 2003, 03:21 PM
#10
Thread Starter
Lively Member
-
Mar 11th, 2003, 03:23 PM
#11
Sleep mode
Re: Thanks
Originally posted by BurnMan2003
Will this work in VB6?
What ! VB6 ???
-
Mar 11th, 2003, 03:26 PM
#12
Thread Starter
Lively Member
Yes
yes... VB6, I have to finish this by semester's end, and I don't have time to learn another language and the ne wstuff in .NET. Can you please help! Thanks man!
-
Mar 11th, 2003, 03:26 PM
#13
Sleep mode
Re: Thanks
Originally posted by BurnMan2003
Will this work in VB6?
It won't work .
Just try what I've posted , it should work !
-
Mar 11th, 2003, 03:30 PM
#14
Thread Starter
Lively Member
OK
Using my coding from the command button, where should I insert your code for best results?
-
Mar 11th, 2003, 03:34 PM
#15
Sleep mode
-
Mar 11th, 2003, 03:35 PM
#16
Thread Starter
Lively Member
-
Mar 11th, 2003, 03:45 PM
#17
Member
Try using the Shell() VB function, passing in the path to your wav file. This will run on a seperate thread.
-
Mar 11th, 2003, 03:57 PM
#18
Sleep mode
Re: Flash
try this now : add timer1 to your form !
VB Code:
Private Sub cmdSubmit_Click()
' Validate Inputs
On Error GoTo Err_Check
Dim strsql As String
strsql = "Select * FROM tblUsers Where UserName = '" & txtUserName.Text & "'"
'Show flash movie
FireTimer
Set rst = New ADODB.Recordset
rst.Open strsql, cnn, adOpenForwardOnly, adLockReadOnly
If Not rst.EOF And Not rst.BOF Then
If rst!Password = txtPwd.Text Then
'Stop the timer
Timer1.Enabled = False
frmSwitch.Show
Me.Hide
Else
flaVerify.Visible = False
'Stop the timer
Timer1.Enabled = False
MsgBox "Invalid Password"
cmdSubmit.Enabled = True
End If
Else
'Stop the timer
Timer1.Enabled = False
flaVerify.Visible = False
MsgBox "Invalid User Name"
cmdSubmit.Enabled = True
End If
rst.Close
Exit_Check:
Set rst = Nothing
Exit Sub
Err_Check:
MsgBox Err.Description, "Login Function"
Resume Exit_Check
End Sub
Sub FireTimer()
Timer1.Enabled = True
flaVerify.Visible = True
cmdSubmit.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = False
End Sub
-
Mar 11th, 2003, 03:59 PM
#19
Thread Starter
Lively Member
-
Mar 11th, 2003, 04:12 PM
#20
Thread Starter
Lively Member
Gonna have to check it out, because it is still bypassing showing the flash movie when I click the button. It shoudl always show the flash before jumping pages, and it isn't... why????
-
Mar 11th, 2003, 04:25 PM
#21
Sleep mode
Is flaVerify form or flash object ?? Does the form overrides the movie ??
-
Mar 11th, 2003, 04:27 PM
#22
Thread Starter
Lively Member
flaVerify is the flash movie.... not sure what you mean my overrides movie. It should be shown for 2 seconds before the database is even accessed to search.. just for show you know!
-
Mar 11th, 2003, 04:34 PM
#23
Sleep mode
try this site which has a good splash screens . It's easy but you missed something out there . I gotta go now 
-
Mar 11th, 2003, 04:40 PM
#24
Sleep mode
Re: Re: Flash
I added StopTimer sub . see if it helps !
Originally posted by Pirate
try this now : add timer1 to your form !
VB Code:
Private Sub cmdSubmit_Click()
' Validate Inputs
On Error GoTo Err_Check
Dim strsql As String
strsql = "Select * FROM tblUsers Where UserName = '" & txtUserName.Text & "'"
'Show flash movie
FireTimer
Set rst = New ADODB.Recordset
rst.Open strsql, cnn, adOpenForwardOnly, adLockReadOnly
If Not rst.EOF And Not rst.BOF Then
If rst!Password = txtPwd.Text Then
'Stop the timer
StopTimer
frmSwitch.Show
Me.Hide
Else
flaVerify.Visible = False
'Stop the timer
StopTimer
MsgBox "Invalid Password"
cmdSubmit.Enabled = True
End If
Else
'Stop the timer
StopTimer
flaVerify.Visible = False
MsgBox "Invalid User Name"
cmdSubmit.Enabled = True
End If
rst.Close
Exit_Check:
Set rst = Nothing
Exit Sub
Err_Check:
MsgBox Err.Description, "Login Function"
Resume Exit_Check
End Sub
Sub FireTimer()
Timer1.Enabled = True
flaVerify.Visible = True
cmdSubmit.Enabled = False
End Sub
Sub StopTimer()
Timer1.Enabled = False
flaVerify.Visible = False
cmdSubmit.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Interval = 3000
Timer1.Enabled = False
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|