473,796 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1749
* "peter hansen" <wo**@tell.yo u> 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%2 3xQOutWDHA.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.yo u> wrote in message
news:en******** ******@TK2MSFTN GP11.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(ByVa l sender As System.Object, ByVal e As
System.EventArg s) 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.DoE vents()
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.yo u> wrote in message
news:en******** ******@TK2MSFTN GP11.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.yo u> 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\SplashC rash and the two projects underneath it. You should open
c:\temp\splashc rash\splashcras h.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.yo u> wrote in message
news:en******** ******@TK2MSFTN GP11.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

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

Similar topics

1
1634
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 need it from a .DLL file. I then use CreateInstance to create the instance of the class, and then use the instance like I would use is with a normal design-time included assembly. But the problem is, no matter how I try with closing the form,...
9
4429
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++ program -- DSN710.SDSNSAMP(DSN8DLPL) to use for this purpose. I'm wondering if anyone out there has a COBOL equivalent to this as I do not have a C++ compiler?
2
1606
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 directory and it looks like ASPNET runtime is holding on to the assemblies. Once i recycle the ASPNET process, i can delete this directory. Has this got anything to do with strong-named/signed assemblies ( even though deployed as private...
3
1186
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 fires, etc., but the raised event continues to be captured in the forms. The form is opened from a sub on the main form, like Dim frm as frmMine frm = new frmMine frm.show
0
1569
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 asp.Net application. Occasionaly, especially during peek CPU usage, the appDomain of the application gets unloaded by the w3wp.exe, and the background thread is terminated (we receive thread was being aborted exception). I guess the reason for...
2
4217
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 whenever the user clicks the CLOSE button, i ask the user whether he wants to save before closing the form. On the Form_Unload event, i check whether there are any new changes and if yes, i pompt the user for a save. But if they have not filled any of...
1
1671
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 does all the ADO with it, but when check1.value = true its doing the ADO commands, but just not unloading, if anyone can shed some light would be most greatful. Kind Regards Devon. Module code. Option Explicit Public g_fmrSearch As...
0
1306
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 the task manager-"Applications" tab,i can detect it and prevent it from unloading,but if it is closed from the task manager-"Processes" tab,the form will be closed even without passing through the terminate,queryunload and unload events... I'm...
6
2052
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 both the keys.if at any instant both the keys are pressed a messagebox must be displayed and then the form must unload. I've done the coding and what happens is the message box is displayed but the form doesnt unload. I've tried debugging...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10242
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.