please need help .. I have form1 and form2 ..
is there any way that as soon as form1 is launched form 2 will also be launched above the form1 and stay a while and unload itself..
Printable View
please need help .. I have form1 and form2 ..
is there any way that as soon as form1 is launched form 2 will also be launched above the form1 and stay a while and unload itself..
How long do you want form2 to remain open for?
Edit:
You could try one of the methods here.
try something like this
Code:Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
With ProgressBar1
.Min = 0
.Max = 10
.Value = 0
.Visible = True
End With
End Sub
Private Sub Timer1_Timer()
If ProgressBar1.Value < 10 Then
ProgressBar1.Value = ProgressBar1.Value + 1
Else
ProgressBar1.Value = 0
ProgressBar1.Visible = False
Unload Me
Timer1.Enabled = False
End If
End Sub
thanks .. I actually solved my problem by this code
In this code label1 is used to show the progress count .. how to add label2 which will run different item name .. like loading different itemsCode:Option Explicit
Dim cnt As Integer
Private Sub Form_Load()
Picture2.Height = Picture1.Height
Picture2.BackColor = vbBlue
Picture2.Width = 0
tm.Enabled = True
tm.Interval = 1
End Sub
Private Sub tm_Timer()
Picture2.Refresh
Picture1.Refresh
cnt = cnt + 1
Label1.Caption = (cnt) & " % "
If cnt > 100 Then
Picture2.Width = Picture1.Width
cnt = 0
Unload Me
Picture2.Width = Picture1.Width
tm.Enabled = False
Unload Me
Else
Picture2.Width = (cnt / 100) * Picture1.Width
End If
End Sub
do u need to add a label at runtime? or u already had label2 in the form?
if i understand corectly may be this is u need
Code:Private Sub tm_Timer()
Picture2.Refresh
Picture1.Refresh
cnt = cnt + 1
Label1.Caption = cnt & " % "
Label2.Caption = "Product " & cnt
If cnt > 100 Then
Picture2.Width = Picture1.Width
cnt = 0
Unload Me
where from u wil get that product names?
use Array() function to list products, try something like this
remember array starting count is 0, means 0 = Bread, 1 = Cake ....Code:PrdAr = Array("Bread", "Cake", "Biscuit") 'add more
Label2.Caption = PrdAr(cnt)
Don't forget to mark the thread "Resolved".
declare it as variant
orCode:Dim PrdAr As Variant
Code:Dim PrdAr
ur cnt value getting more than ur array value, if u set 10 items in array it means 0-9 only, so ur cnt value shuld be with in that limit.
post ur complete code, or if posible attach ur project as zip file.
ok here is a sample .. I have placed Label2 on form which i intend to show products .. [Loading --- bread then water and so on ]
try like this
Code:Option Explicit
Dim cnt As Integer
Dim PrdAr
Private Sub Form_Load()
PrdAr = Array("Product1", "Product2", "Product3", "Product4", "Product5", _
"Product6", "Product7", "Product8", "Product9", "Product10")
Picture2.Height = Picture1.Height
Picture2.BackColor = vbBlue
Picture2.Width = 0
tm.Enabled = True
tm.Interval = 1
End Sub
Private Sub tm_Timer()
Picture2.Refresh
Picture1.Refresh
cnt = cnt + 1
Label1.Caption = cnt & " % "
If cnt Mod 10 = 0 Then
Label2.Caption = PrdAr(Int(cnt / 10) - 1)
End If
If cnt > 100 Then
Picture2.Width = Picture1.Width
cnt = 0
Unload Me
Else
Picture2.Width = (cnt / 100) * Picture1.Width
End If
End Sub
Thanks brother for your help .. it worked fine .. to save the space of the forum by making another thread please help me bit more so that I will make thread resolve..
I have another code where instead of message box I want to show form with label1 for programme used count
code
Code:Private Sub Form_Load()
On Error Resume Next
SaveSetting "hh", "StartupForm", "TimesRun", GetSetting("hh", "StartupForm", "TimesRun", 0) + 1
Timesrun = GetSetting("hh", "StartupForm", "TimesRun")
MsgBox "You have Used this programme " & Timesrun & " times"
End Sub
it's better start a new thread, so many person wil help u, and i wil too
That does not save any space at all... what it does is save you a tiny amount of effort, while making things more confusing and annoying for all of the people who try to help (whether they have replied or not).
If your original question has been answered, be polite and mark the thread as Resolved (which allows people who help to focus on the things that haven't been answered yet). You may also want to Rate the posts of the people who helped.
If you have another question that is not a direct extension of the question at the top of the thread, create a new thread for it. There are several reasons why nearly everyone does that and you should too, including many that benefit you (such as more chance of other people reading your question, thus more chance of a good answer).
change to
not tested, hope it's corectCode:If cnt Mod 5 = 0 Then
Label2.Caption = PrdAr(Int(cnt / 5) - 1)
End If