473,395 Members | 1,623 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,395 software developers and data experts.

Unloading af form

I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.
The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds
it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefor is
the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)

// Kian
Nov 20 '05 #1
10 1717
* "peter hansen" <wo**@tell.you> scripsit:
I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.


<http://www.google.com/groups?selm=u%23xQOutWDHA.2100%40TK2MSFTNGP11.phx. gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Cor
Hi Peter,

If you use another approach maybe the answer is easier

Create a kind of main form
Create your splash form
In the load event of your main form you say
\\\
dim frm as new splashform
me.hide
frm.showdialog
me.show
frm.dispose
///
And that is all,
Cor

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.
The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefor is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)

// Kian

Nov 20 '05 #3
Kian,

How a Sub Main that controls the startup process

Public Sub Main()
Dim f As New SpashForm

f.Show
' loading project resources here
f.Dispose()
f = Nothing

Dim fm as New MyMainForm

fm.ShowDialog()
fm.Dispose()
fm = Nothing
End Sub

"peter hansen" <wo**@tell.you> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.
The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefor is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)

// Kian

Nov 20 '05 #4
The simplest method is to show the splash screen from your startup form,
like this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim splash As New SplashForm
splash.Show()
' simulate normal initialization code here
' you wouldn't keep this dummy loop in a normal app
For i As Integer = 1 To 500000
Application.DoEvents()
Next
splash.Hide()
End Sub

Note that this simple method doesn't let the splash screen receive Paint
messages or perform any processing it needs to do, such as running an
animation. For a more robust version, see this article:
http://msdn.microsoft.com/library/de...ml/casoast.asp

"peter hansen" <wo**@tell.you> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.
The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefor is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)

// Kian

Nov 20 '05 #5
> The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefore is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)


The reason for your trouble is that in VB.NET, whatever your project calls
its "Startup Object" in the Project Properties dialog, is the thing that
provides the "Message Loop". Without a message loop, an application will
launch, appear briefly and then exit.

If your startup object is a form, that startup form holds the message loop.
When that form closes, the message loop ends and the application exits. You
have two solutions:

If you want your project to start from a form, set your main form to be the
startup object, and use the load event of your main form to show the splash
screen. (Don't forget to set the TopMost property of the splash form on its
property window)

frmMain.vb:

Private Sub frmMain_Load(...)

'frmMain is set to be the project's startup object.
'frmMain owns the message loop.

frmSplash.Show()

End Sub

If you want your project to start from Sub Main, do this:

basGlobal.vb:

Module basGlobal

Public Sub Main()

'Here, there is no form that owns a message loop because
'the startup object is Sub Main(). The message loop is
'handled by Application.Run() and is associated with
'whatever form you create an instance of, and pass to it.

frmSplash.Show()
Application.Run(New frmMain()))

End Sub

End Module
--
Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Nov 20 '05 #6
OOPS!! Some Corrections: (That's what I get for typing it in a usenet post
instead of pasting it from a code window!)
frmMain.vb:

Private Sub frmMain_Load(...)

'frmMain is set to be the project's startup object.
'frmMain owns the message loop.
Dim f As New frmSplash()
f.Show()
End Sub basGlobal.vb:

Module basGlobal

Public Sub Main()

'Here, there is no form that owns a message loop because
'the startup object is Sub Main(). The message loop is
'handled by Application.Run() and is associated with
'whatever form you create an instance of, and pass to it.

Dim f As New frmSplash()
f.Show() Application.Run(New frmMain()))

End Sub

End Module

--
Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Nov 20 '05 #7
Well... you have all refered to my old question and your own answers which
wasn't (sorry) good enough :D
I need to unload one single form... and by using all your answers the entire
program is beeing unloaded.

// Peter

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:br*************@ID-208219.news.uni-berlin.de...
* "peter hansen" <wo**@tell.you> scripsit:
I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form) command.
I have tried the Close-function but it'll unload the entire projekt.

<http://www.google.com/groups?selm=u%...TNGP11.phx.gbl

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
> Well... you have all refered to my old question and your own answers which
wasn't (sorry) good enough :D
I need to unload one single form... and by using all your answers the entire program is beeing unloaded.


Here is a code sample for you:

http://www.vbsensei.com/SplashCrash.zip

I have made a solution with two projects. The first project shows how to do
your splash screen if the project starts from Form1 (the main form) and the
splash screen is Form2. The second project shows you how to have a main
form (form1) and a splash form (form2) but startup from a Sub Main.

This Zip archive should be unzipped "with folders" so that it will create
C:\Temp\SplashCrash and the two projects underneath it. You should open
c:\temp\splashcrash\splashcrash.sln with VS.NET

If you are using VS.NET 2K3, you will get a conversion prompt. Just click
yes. I did this demo in VS.NET 2K2 for backward compatibility.

And no, I don't have a real web site. if you goto www.vbsensei.com by
itself, you will find nothing, because I don't have a default page. I just
use this web server to post articles and "gimmie files" to the world.

--
Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Nov 20 '05 #9
me.close()

The other forms need not be "child" forms of the splash screen.

This will not close all the forms, just the one that me.close() is in.
"peter hansen" <wo**@tell.you> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
I tried a couple of weeks ago but I'll try again :D

I old VB6-days it was possible to unload a form bu using the Unload(Form)
command.
I have tried the Close-function but it'll unload the entire projekt.
The reason why I am asking is that I am creating a program and I need a
Splash-screen (like the tiny screen that appears when programs like Word
starts), and when the Splash-screen has been loaded for a couple of seconds it should be unloaded (it is not for any use anymore)... how do I unload
just this form and not the entire project. Remember that this form (the
Splash-form) is the form that trigger triggers the next form and therefor is the 'parent' to the entire project or something (I have been told that by
closing this form with the Close-command it'll close all the Child-forms)

// Kian

Nov 20 '05 #10
* "peter hansen" <wo**@tell.you> scripsit:
Well... you have all refered to my old question and your own answers which
wasn't (sorry) good enough :D
I need to unload one single form... and by using all your answers the entire
program is beeing unloaded.


No, it isn't...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LilleSkutt | last post by:
I want to use assemblies (Window Forms as .dll) so that I can replace the form while the main application is running. To accomplish this, I used Assembly.LoadForm to manually load the assembly when I...
9
by: Rom Marshall | last post by:
Hi. Once a LOB size goes beyond 32KB in size, I'm not able to use the LOAD utility to unload the data off the tables for DB2 7.1 on OS/390. Instead, the documentation refers to a sample C++...
2
by: Guru Prasad | last post by:
Is there a delay involved in unloading assemblies once a virtual directory is "deleted" using IIS Manager ? At times even after the virtual directory is removed i cannot delete the backing physical...
3
by: Glenn | last post by:
I am confused about when a form is unloaded, if ever. I have forms loading as MDI forms that have a withevents reference to a global class raising events. When the forms close, the closed event...
0
by: ibenc | last post by:
Is there a way to prevent w3wp.exe from unloading a particular appDomain. Some parameters, config files? Here is some info about why I need this. I have a long running background thread in...
2
by: RajaKannan | last post by:
Hi All, I have a form in which i have few mandatory fields. Wheneve the user tries to save, i check for these fields and alert them, if thet are empty. I have a CLOSE button in my form and...
1
devonknows
by: devonknows | last post by:
Ok, i posted about forcing a form to unload, now since ive implemented that, when check1.value = true, when you close the form, it doesnt unload, when check1.value = false, it unloads perfectly and...
0
vdraceil
by: vdraceil | last post by:
Hi,i use VB6.0..is it possible to prevent a form from unloading ever? I know to set cancel=true in query unload event of the form..but this applies only to limited cases. If my exe is closed from...
6
vdraceil
by: vdraceil | last post by:
I use vb6.i have a small problem guys..my form is not unloading. I want my application to end only if the user presses shift+F10.so i run a timer with interval=1 which checks the keyboard state of...
0
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...
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
BarryA
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.