Hi
Can anybody help me with the following?
I have a main application, called for the sake of argument Form1, which is
going to be the main source of my application code. I've been trying to
develop a splash screen to appear before the main application appears i.e.
Form1. This splash screen I am going to call Form2.
So, what I'm trying to do is start the application, display Form2 and then
when it closes, display the main form i.e. Form1.
I've searched the web and found a few bright ideas but being a bit of a
novice in VB I'm struggling a bit and a lot of what I've done is guesswork.
Could anybody give me some suggestions?
Geoff 11 971
Geoff,
The most simple one is in the *load* event of your mainform (in the load
event the form is not yet showed)
dim frm as new form2
dim frm2.showdialog
frm2.dispose
And than set in your form2 a timer which runs by instance 10 times
decreasing the opacity ten times with 10 and when it is done 10 times (or
the opacity is 0) say in that timer event me.close
Looks greath however in this way your program is of course waiting for your
splash screen to be ready.
When you have not really big start in processing that does not matter,
because 1 second to show is nothing while in 1 second mostly every startup
process is done by a modern computer, when you want to avoid that you can
use multithreading, however I find that a lot of work when it is for 1
second.
I hope this gives some ideas and when not feel free to ask?
Cor
"Geoff Jones" <no********@email.com> Hi
Can anybody help me with the following?
I have a main application, called for the sake of argument Form1, which is going to be the main source of my application code. I've been trying to develop a splash screen to appear before the main application appears i.e. Form1. This splash screen I am going to call Form2.
So, what I'm trying to do is start the application, display Form2 and then when it closes, display the main form i.e. Form1.
I've searched the web and found a few bright ideas but being a bit of a novice in VB I'm struggling a bit and a lot of what I've done is guesswork.
Could anybody give me some suggestions?
Geoff
Thanks Cor.
That works apart from Form2 appearing before Form1. Is there workround for
that?
By the way, why does this not work for:
dim frm as new form2
frm2.show ' i.e. use show() instead of showdialog()
frm2.dispose
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:e6**************@tk2msftngp13.phx.gbl... Geoff,
The most simple one is in the *load* event of your mainform (in the load event the form is not yet showed)
dim frm as new form2 dim frm2.showdialog frm2.dispose
And than set in your form2 a timer which runs by instance 10 times decreasing the opacity ten times with 10 and when it is done 10 times (or the opacity is 0) say in that timer event me.close
Looks greath however in this way your program is of course waiting for your splash screen to be ready.
When you have not really big start in processing that does not matter, because 1 second to show is nothing while in 1 second mostly every startup process is done by a modern computer, when you want to avoid that you can use multithreading, however I find that a lot of work when it is for 1 second.
I hope this gives some ideas and when not feel free to ask?
Cor
"Geoff Jones" <no********@email.com> Hi
Can anybody help me with the following?
I have a main application, called for the sake of argument Form1, which is going to be the main source of my application code. I've been trying to develop a splash screen to appear before the main application appears i.e. Form1. This splash screen I am going to call Form2.
So, what I'm trying to do is start the application, display Form2 and then when it closes, display the main form i.e. Form1.
I've searched the web and found a few bright ideas but being a bit of a novice in VB I'm struggling a bit and a lot of what I've done is guesswork.
Could anybody give me some suggestions?
Geoff
Geoff,
Please tell me what I don't understand beneath?
Your question I've been trying to develop a splash screen to appear before the main application appears i.e. Form1.
Your answer on my solution That works apart from Form2 appearing before Form1. Is there workround for that?
dim frm as new form2 frm2.show ' i.e. use show() instead of showdialog() frm2.dispose
Probably this works however are your eyes not fast enough to see that frm2.
:-)
Cor "Cor Ligthert" <no************@planet.nl> wrote in message news:e6**************@tk2msftngp13.phx.gbl... Geoff,
The most simple one is in the *load* event of your mainform (in the load event the form is not yet showed)
dim frm as new form2 dim frm2.showdialog frm2.dispose
And than set in your form2 a timer which runs by instance 10 times decreasing the opacity ten times with 10 and when it is done 10 times (or the opacity is 0) say in that timer event me.close
Looks greath however in this way your program is of course waiting for your splash screen to be ready.
When you have not really big start in processing that does not matter, because 1 second to show is nothing while in 1 second mostly every startup process is done by a modern computer, when you want to avoid that you can use multithreading, however I find that a lot of work when it is for 1 second.
I hope this gives some ideas and when not feel free to ask?
Cor
"Geoff Jones" <no********@email.com> Hi
Can anybody help me with the following?
I have a main application, called for the sake of argument Form1, which is going to be the main source of my application code. I've been trying to develop a splash screen to appear before the main application appears i.e. Form1. This splash screen I am going to call Form2.
So, what I'm trying to do is start the application, display Form2 and then when it closes, display the main form i.e. Form1.
I've searched the web and found a few bright ideas but being a bit of a novice in VB I'm struggling a bit and a lot of what I've done is guesswork.
Could anybody give me some suggestions?
Geoff
Hi Cor
Sorry, you're right. I'd obviously changed my strategy in mid-flow i.e. I'd
subsequently thought about shown Form1 first and then Form2.
As a matter of interest, I did it thus:
Me.Show()
frm2.ShowDialog()
frm2.Dispose()
Seems to work but knowing me I'll probably run into problems :)
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl... Geoff,
Please tell me what I don't understand beneath?
Your questionI've been trying to develop a splash screen to appear before the main application appears i.e. Form1.
Your answer on my solution That works apart from Form2 appearing before Form1. Is there workround for that?
dim frm as new form2 frm2.show ' i.e. use show() instead of showdialog() frm2.dispose Probably this works however are your eyes not fast enough to see that frm2.
:-)
Cor
"Cor Ligthert" <no************@planet.nl> wrote in message news:e6**************@tk2msftngp13.phx.gbl... Geoff,
The most simple one is in the *load* event of your mainform (in the load event the form is not yet showed)
dim frm as new form2 dim frm2.showdialog frm2.dispose
And than set in your form2 a timer which runs by instance 10 times decreasing the opacity ten times with 10 and when it is done 10 times (or the opacity is 0) say in that timer event me.close
Looks greath however in this way your program is of course waiting for your splash screen to be ready.
When you have not really big start in processing that does not matter, because 1 second to show is nothing while in 1 second mostly every startup process is done by a modern computer, when you want to avoid that you can use multithreading, however I find that a lot of work when it is for 1 second.
I hope this gives some ideas and when not feel free to ask?
Cor
"Geoff Jones" <no********@email.com> Hi
Can anybody help me with the following?
I have a main application, called for the sake of argument Form1, which is going to be the main source of my application code. I've been trying to develop a splash screen to appear before the main application appears i.e. Form1. This splash screen I am going to call Form2.
So, what I'm trying to do is start the application, display Form2 and then when it closes, display the main form i.e. Form1.
I've searched the web and found a few bright ideas but being a bit of a novice in VB I'm struggling a bit and a lot of what I've done is guesswork.
Could anybody give me some suggestions?
Geoff
Geoff,
Now you show with that me.show your first form and becomes it not so nice in
my opinion.
Than I would take this one (I made it some minutes ago because I found my
other sample to difficult)
\\\Form1 needs 2 labels
Private WithEvents frm1 As Form2
Private Delegate Sub Frm1Handler(ByVal message As String)
Private MyThread As System.Threading.Thread
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim timer1 As New System.Windows.Forms.Timer
AddHandler timer1.Tick, AddressOf mytimer1
Label1.Text = "0"
Label2.Text = "Do you see me?"
timer1.Enabled = True
timer1.Interval = 400
Dim timer2 As New System.Windows.Forms.Timer
frm1 = New Form2
frm1.Owner = Me
frm1.Width = Me.Width - 40
frm1.Height = Me.Height - 40
frm1.Left = Me.Left + 20
frm1.Top = Me.Top + 20
AddHandler frm1.ready, AddressOf Frm1Ready
MyThread = New System.Threading.Thread(AddressOf frm1.Show)
MyThread.Start()
End Sub
Private Sub mytimer1(ByVal sender As Object, _
ByVal e As System.EventArgs)
Label1.Text = (CInt(Label1.Text) + 1).ToString
DirectCast(sender, System.Windows.Forms.Timer).Enabled = True
End Sub
Private Sub Frm1Ready(ByVal message As String)
Me.BeginInvoke(New Frm1Handler(AddressOf Frm1HandlerSub), New
Object() {message})
End Sub
Private Sub Frm1HandlerSub(ByVal message As String)
frm1.Close()
Label2.Text = message
MyThread.Abort()
End Sub
Private Sub Form1_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
If Not MyThread Is Nothing Then
MyThread.Abort()
End If
End Sub
///
\\\Form 2 needs 1 label
Friend Event ready(ByVal message As String)
Private Sub Form2_Activated(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Activated
Dim timenext As DateTime = Now.Add(TimeSpan.FromSeconds(10))
Do While timenext > Now
Label1.Text = Now.TimeOfDay.ToString
Application.DoEvents() 'to show the time
Threading.Thread.Sleep(50)
Me.Opacity -= 0.004
Loop
RaiseEvent ready(Now.TimeOfDay.ToString)
End Sub
Private Sub Form2_Closing(ByVal sender As Object, ByVal _
e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
RaiseEvent ready(Now.TimeOfDay.ToString)
End Sub
///
I think than this one is nicer, give it a try
I hope this helps?
Cor
"Geoff Jones" <no********@email.com> Hi Cor
Sorry, you're right. I'd obviously changed my strategy in mid-flow i.e. I'd subsequently thought about shown Form1 first and then Form2.
As a matter of interest, I did it thus:
Me.Show() frm2.ShowDialog() frm2.Dispose()
Seems to work but knowing me I'll probably run into problems :)
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:uY**************@TK2MSFTNGP12.phx.gbl... Geoff,
Please tell me what I don't understand beneath?
Your questionI've been trying to develop a splash screen to appear before the main application appears i.e. Form1.
Your answer on my solution That works apart from Form2 appearing before Form1. Is there workround for that?
dim frm as new form2 frm2.show ' i.e. use show() instead of showdialog() frm2.dispose Probably this works however are your eyes not fast enough to see that frm2.
:-)
Cor
"Cor Ligthert" <no************@planet.nl> wrote in message news:e6**************@tk2msftngp13.phx.gbl... Geoff,
The most simple one is in the *load* event of your mainform (in the load event the form is not yet showed)
dim frm as new form2 dim frm2.showdialog frm2.dispose
And than set in your form2 a timer which runs by instance 10 times decreasing the opacity ten times with 10 and when it is done 10 times (or the opacity is 0) say in that timer event me.close
Looks greath however in this way your program is of course waiting for your splash screen to be ready.
When you have not really big start in processing that does not matter, because 1 second to show is nothing while in 1 second mostly every startup process is done by a modern computer, when you want to avoid that you can use multithreading, however I find that a lot of work when it is for 1 second.
I hope this gives some ideas and when not feel free to ask?
Cor
"Geoff Jones" <no********@email.com> > Hi > > Can anybody help me with the following? > > I have a main application, called for the sake of argument Form1, > which is going to be the main source of my application code. I've been > trying to develop a splash screen to appear before the main > application appears i.e. Form1. This splash screen I am going to call > Form2. > > So, what I'm trying to do is start the application, display Form2 and > then when it closes, display the main form i.e. Form1. > > I've searched the web and found a few bright ideas but being a bit of > a novice in VB I'm struggling a bit and a lot of what I've done is > guesswork. > > Could anybody give me some suggestions? > > Geoff > > >
Hi Cor
Wow - thanks for the code. It uses delegates, which I have only just started
reading about but I will certainly go through your example to see how it
works. Best way to learn in my opinion!
As a matter of interest, why is the me.show within the Load member
undesirable?
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oe**************@TK2MSFTNGP14.phx.gbl... Geoff,
Now you show with that me.show your first form and becomes it not so nice in my opinion.
Than I would take this one (I made it some minutes ago because I found my other sample to difficult)
\\\Form1 needs 2 labels Private WithEvents frm1 As Form2 Private Delegate Sub Frm1Handler(ByVal message As String) Private MyThread As System.Threading.Thread Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim timer1 As New System.Windows.Forms.Timer AddHandler timer1.Tick, AddressOf mytimer1 Label1.Text = "0" Label2.Text = "Do you see me?" timer1.Enabled = True timer1.Interval = 400 Dim timer2 As New System.Windows.Forms.Timer frm1 = New Form2 frm1.Owner = Me frm1.Width = Me.Width - 40 frm1.Height = Me.Height - 40 frm1.Left = Me.Left + 20 frm1.Top = Me.Top + 20 AddHandler frm1.ready, AddressOf Frm1Ready MyThread = New System.Threading.Thread(AddressOf frm1.Show) MyThread.Start() End Sub Private Sub mytimer1(ByVal sender As Object, _ ByVal e As System.EventArgs) Label1.Text = (CInt(Label1.Text) + 1).ToString DirectCast(sender, System.Windows.Forms.Timer).Enabled = True End Sub Private Sub Frm1Ready(ByVal message As String) Me.BeginInvoke(New Frm1Handler(AddressOf Frm1HandlerSub), New Object() {message}) End Sub Private Sub Frm1HandlerSub(ByVal message As String) frm1.Close() Label2.Text = message MyThread.Abort() End Sub Private Sub Form1_Closing(ByVal sender As Object, _ ByVal e As System.ComponentModel.CancelEventArgs) _ Handles MyBase.Closing If Not MyThread Is Nothing Then MyThread.Abort() End If End Sub /// \\\Form 2 needs 1 label Friend Event ready(ByVal message As String) Private Sub Form2_Activated(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Activated Dim timenext As DateTime = Now.Add(TimeSpan.FromSeconds(10)) Do While timenext > Now Label1.Text = Now.TimeOfDay.ToString Application.DoEvents() 'to show the time Threading.Thread.Sleep(50) Me.Opacity -= 0.004 Loop RaiseEvent ready(Now.TimeOfDay.ToString) End Sub Private Sub Form2_Closing(ByVal sender As Object, ByVal _ e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing RaiseEvent ready(Now.TimeOfDay.ToString) End Sub ///
I think than this one is nicer, give it a try
I hope this helps?
Cor
"Geoff Jones" <no********@email.com> Hi Cor
Sorry, you're right. I'd obviously changed my strategy in mid-flow i.e. I'd subsequently thought about shown Form1 first and then Form2.
As a matter of interest, I did it thus:
Me.Show() frm2.ShowDialog() frm2.Dispose()
Seems to work but knowing me I'll probably run into problems :)
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:uY**************@TK2MSFTNGP12.phx.gbl... Geoff,
Please tell me what I don't understand beneath?
Your question I've been trying to develop a splash screen to appear before the main application appears i.e. Form1.
Your answer on my solution That works apart from Form2 appearing before Form1. Is there workround for that?
dim frm as new form2 frm2.show ' i.e. use show() instead of showdialog() frm2.dispose
Probably this works however are your eyes not fast enough to see that frm2.
:-)
Cor "Cor Ligthert" <no************@planet.nl> wrote in message news:e6**************@tk2msftngp13.phx.gbl... > Geoff, > > The most simple one is in the *load* event of your mainform (in the > load event the form is not yet showed) > > dim frm as new form2 > dim frm2.showdialog > frm2.dispose > > And than set in your form2 a timer which runs by instance 10 times > decreasing the opacity ten times with 10 and when it is done 10 times > (or the opacity is 0) say in that timer event me.close > > Looks greath however in this way your program is of course waiting for > your splash screen to be ready. > > When you have not really big start in processing that does not matter, > because 1 second to show is nothing while in 1 second mostly every > startup process is done by a modern computer, when you want to avoid > that you can use multithreading, however I find that a lot of work > when it is for 1 second. > > I hope this gives some ideas and when not feel free to ask? > > Cor > > "Geoff Jones" <no********@email.com> >> Hi >> >> Can anybody help me with the following? >> >> I have a main application, called for the sake of argument Form1, >> which is going to be the main source of my application code. I've >> been trying to develop a splash screen to appear before the main >> application appears i.e. Form1. This splash screen I am going to call >> Form2. >> >> So, what I'm trying to do is start the application, display Form2 and >> then when it closes, display the main form i.e. Form1. >> >> I've searched the web and found a few bright ideas but being a bit of >> a novice in VB I'm struggling a bit and a lot of what I've done is >> guesswork. >> >> Could anybody give me some suggestions? >> >> Geoff >> >> >> > >
Geoff As a matter of interest, why is the me.show within the Load member undesirable?
It freezes and that has on that place no sense, than I prefer it in a splash
situation not to show it.
Think by instance that this is a login screen. The users sees nothing than
when he has the wrong password. By instance with this code.
dim frm as new loginform
frm.showdialog
if frm.passwordcheck is false then me.close
'this above can much nicer however for the sample.
The user does not even see the program than.
However just my idea, I hope it makes sense?
Cor
I see. Yes, I see your point; although I'm not sure what you mean by
"freeze"
Here is the code from both forms - Form1 being the main application window:
'This is Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Show()
Dim frm As New Form2
frm.ShowDialog()
frm.Dispose()
End Sub
+++++++++++++++++++++++++++++++++++++++++++
'This is Form2
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Me.Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Start() ' Interval set to something "large" so we can see Form2 for a
bit
End Sub
It works, but I'm going to go through your example to learn about threads
(gulp!) and delegates (double gulp!) LOL. Has to be done at some point!!!
Thanks for your continuing help.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ek**************@TK2MSFTNGP15.phx.gbl... Geoff As a matter of interest, why is the me.show within the Load member undesirable? It freezes and that has on that place no sense, than I prefer it in a splash situation not to show it.
Think by instance that this is a login screen. The users sees nothing than when he has the wrong password. By instance with this code.
dim frm as new loginform frm.showdialog if frm.passwordcheck is false then me.close 'this above can much nicer however for the sample.
The user does not even see the program than.
However just my idea, I hope it makes sense?
Cor
Hi Cor
Just thought I'd let you know I have been through your code and am very
impressed. Some very good ideas.
Thanks
Geoff
"Geoff Jones" <no********@email.com> wrote in message
news:41**********************@news.dial.pipex.com. .. I see. Yes, I see your point; although I'm not sure what you mean by "freeze"
Here is the code from both forms - Form1 being the main application window:
'This is Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() Dim frm As New Form2 frm.ShowDialog() frm.Dispose() End Sub +++++++++++++++++++++++++++++++++++++++++++ 'This is Form2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Close() End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() ' Interval set to something "large" so we can see Form2 for a bit End Sub
It works, but I'm going to go through your example to learn about threads (gulp!) and delegates (double gulp!) LOL. Has to be done at some point!!!
Thanks for your continuing help.
Geoff
"Cor Ligthert" <no************@planet.nl> wrote in message news:ek**************@TK2MSFTNGP15.phx.gbl... Geoff As a matter of interest, why is the me.show within the Load member undesirable? It freezes and that has on that place no sense, than I prefer it in a splash situation not to show it.
Think by instance that this is a login screen. The users sees nothing than when he has the wrong password. By instance with this code.
dim frm as new loginform frm.showdialog if frm.passwordcheck is false then me.close 'this above can much nicer however for the sample.
The user does not even see the program than.
However just my idea, I hope it makes sense?
Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Huzefa |
last post by:
I am working on a amll project in Java that includes many classes.
Each of the classes has a Logger object. I have associated a
FileHandler with
each of these Logger objects. The file is the same...
|
by: Zunbeltz Izaola |
last post by:
Hi
I have create two threads (from threading module). I want to
synchronize this two in the folowwing way
def Threa1func():
do stuff..
while something
if test:
CHANGE TO Thread2
|
by: Steven Bethard |
last post by:
I'm playing around with some threading stuff right now, and I'm having a
little trouble calling a function from one thread that affects another.
Here's my setup:
py> import os, threading, time...
|
by: MikeE |
last post by:
Hi all,
What's the best way to queue up and wait for number of threads to complete.
This problem was trivial in VC++ 6 but I'm finding it rather hard to solve
in VB.NET. My calculations run...
|
by: Luk Vloemans |
last post by:
Hey,
Having a few problems using threads in C#. In the msdn documentation,
mutual exclusion is only discussed when dealing with threads that all
execute the same method.
What's the actual...
|
by: mareal |
last post by:
I am trying to write a basic load balancer (in our web service) solution. The
purpose of this load balancer is to keep an array updated with server status.
We have several servers that can be...
|
by: MSDousti |
last post by:
Hi
I have written a VB .NET app, which uses several threads. I thought
that when the user closes the main window (when MainForm.closed event
occures, and I call application.exit) all running...
|
by: Jerry Spence1 |
last post by:
How can I gain access to all the threads running in my application? I'm
looking for something like:
Application.Threads.count
Application.threads(item).IsAlive
Application.threads(item).Name
...
|
by: gsimmons |
last post by:
I've been researching multi-threaded WinForms apps and thread
synchronization stuff for a couple days since I'm working on
refactoring a multi-threaded GUI app at work and want to be sure it's...
|
by: tdahsu |
last post by:
All,
I'd appreciate any help. I've got a list of files in a directory, and
I'd like to iterate through that list and process each one. Rather
than do that serially, I was thinking I should...
|
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,...
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |