Oplossingen voor veelkomende problemen
Google
Tutorials
Sip spoof alcatel modem (kpn)
Ping computer on network
Firewall Alcatel 510 uitzetten
Overzicht DNS Servers nederlandse providers
Nslookup
Afdruk samenvoegen word
Exchange mail forwarden naar pop3 account
Service verwijderen
Telnet
Renaming ISA Server 2000
Renaming ISA Server 2004
Browsing on ISA
Ctrack instaleren
Programeren
ADO.net
Printen in Visual Basic .Net
Control Array
Tostring
Type conversion
Check of invoerde waarde een getal is
Embedded image email
Regular expression validator
File system object (kopieren en verplaatsen bestanden)
Vartype
Looping door textboxen
Server Variables
LCID property
Startup object in visual studio 2003
Sql
Data types van Sql 2000
SQL Select statement
SQL Joins
SQL Distinct
SQL Count
Diversen
Overzicht lite adsl
Home
Ilse virusmelding
Ex-dividend
Ex-dividend AEX
Datum ex-dividend AEX
Ex-dividend AMX
Datum ex-dividend AMX
Financiele Agenda AEX
Financiele Agenda AMX
Home

Start your application in Visual Studio 2003
By Simon Jorritsma

There are many ways for determining what the user will see when your application starts. Setting the Startup Form By default, the first form in your application is designated as the startup form. When your application starts running, this form is displayed (so the first code to execute is the code in the Form_Initialize event for that form).

If you want a different form to display when your application starts, you must change the startup form.

To change the startup form From the Project menu:

  1. Right click on project
  2. Properties.
  3. General tab.
  4. In the Startup Object list box, select the form you want as the new startup form.
  5. Choose OK.

Sometimes you want to startup Form without any form initially loaded. For example, you might want to execute code that loads a registry entry and then displays one of several different forms depending on what is in the registry. You can do this by creating a Sub procedure called Main in a standard module, as in the following example:

Create a Sub main()

  1. Right click on project
  2. Add
  3. Add module
  4. Change name in StartUp.vb
  5. Type "Sub Main"
  6. Your code
  7. Right click on project
  8. Prperties
  9. General tab
  10. Startup Object choose Sub Main()
  11. Choose OK

Example sub Main()

Sub Main()
Dim strRegistryEntry As Integer
' Call a function procedure to check registry.
strRegistryEntry = GetUserStatus
' Show a startup form based on status.
If strRegistryEntry = 1 Then
frmMain.Show
Else
frmLanguage.Show
End If

This procedure must be a Sub procedure, and it cannot be in a form module.

Displaying a Splash Screen on Startup

If you need to execute a lengthy procedure on startup, such as loading a large amount of data from a database or loading several large bitmaps, you might want to display a splash screen on startup. A splash screen is a form, usually displaying information such as the name of the application, copyright information, and a simple bitmap. To display a splash screen, use a Sub Main procedure as your startup object and use the Show method to display the form:

Private Sub Main()
appContext = New ApplicationContext()
fMainForm = New MainForm()
fSplash = New SplashForm()
'Show Splash Form
fSplash.Show()

'You can use a timer here to unload the splash
'screen after a certain amount of time or do other
'initialization tasks

'Show Main Form
fMainForm.Show()
appContext.MainForm = fMainForm
Application.Run(appContext)
End Sub

The splash screen occupies the user's attention while your startup procedures are executing, giving the illusion that the application is loading faster. When the startup procedures are completed, you can load your first form and unload the splash screen.

Ending an Application

An event-driven application stops running when all its forms are closed and no code is executing. If a hidden form still exists when the last visible form is closed, your application will appear to have ended (because no forms are visible), but will in fact continue to run until all the hidden forms are closed. This situation can arise because any access to an unloaded form's properties or controls implicitly loads that form without displaying it. The best way to avoid this problem when closing your application is to make sure all your forms are unloaded. If you have more than one form, you can use the Forms collection and the Unload statement. For example, on your main form you could have a command button named cmdQuit that lets a user exit the program. If your application has only one form, the Click event procedure could be as simple as this:

Private Sub cmdQuit_Click ()
Unload Me
End Sub

If your application uses multiple forms, you can unload the forms by putting code in the Unload event procedure of your main form. You can use the Forms collection to make sure you find and close all your forms. The following code uses the forms collection to unload all forms:

Private Sub Form_Unload (Cancel As Integer)
Dim i as integer
' Loop through the forms collection and unload
' each form.
For i = Forms.Count – 1 to 0 Step - 1
Unload Forms(i)
Next
End Sub

 

Google


Simon Jorritsma
email : simon @ mixfix.nl

mixfix voor uw koffie en koffieapparatuur

Disclaimer Chiller  Freshone  Ex-Dividend Dividend Breien

Disclaimer: Al deze informatie wordt je aangeboden 'zoals het is' en voor eventuele fouten in de tekst en voor de eventuele (negatieve) gevolgen daarvan neem ik geen verantwoording! Dit hele aanpassen geschied dan ook geheel op eigen risico!

 

Niets uit deze uitgave mag zonder schriftelijke toestemming van S.Jorritsma worden gekopieerd, gedownload, verveelvoudigd, opgeslagen in een geautomatiseerd gegevensbestand of openbaar gemaakt, in enige vorm of op enige wijze, hetzij elektronisch, mechanisch, door fotokopieën, opnamen, of enig andere manier.
 

 
maandag 6 februari 2012