Visual Basic .net Splash Screen

J03

~~~~~~~~
Messages
5,558
Location
Wales
Hi all. I am trying to make a Splash Screen in VB net. I have completed the screen its self, but i need a snippet of code to make it only stay on the screen for 5 seconds.... I think it is a really simple piece of code, but since i only started yesterday, i dont know here to look to get it. Thanks in advance, samurai.
 
-Make a timer and set the interval to "1000"(1000=1sec). make a counter in the
general (Dim counter As Byte).
-Put counter = 0 in form load
-Now in the timer sub enter:

counter = counter +1 ' Every second the timer will add one to the counter
if counter = 5 then
frmSplash.visible = false 'What ever you named your splash screen
frmMain.visible = true ' Whatever you named your screen after the splash
end if
 
Err.... Can i give you the code for the splash? ( i am not sure how to do all that, but thanks) :D


Code:
Public NotInheritable Class splash

	'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
	'  of the Project Designer ("Properties" under the "Project" menu).


	Private Sub splash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		'Set up the dialog text at runtime according to the application's assembly information.  

		'TODO: Customize the application's assembly information in the "Application" pane of the project 
		'  properties dialog (under the "Project" menu).

		'Application title
		If My.Application.Info.Title <> "" Then
			ApplicationTitle.Text = My.Application.Info.Title
		Else
			'If the application title is missing, use the application name, without the extension
			ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
		End If

		'Format the version information using the text set into the Version control at design time as the
		'  formatting string.  This allows for effective localization if desired.
		'  Build and revision information could be included by using the following code and changing the 
		'  Version control's designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar.  See
		'  String.Format() in Help for more information.
		'
		'	Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

		Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)

		'Copyright info
		Copyright.Text = My.Application.Info.Copyright
	End Sub

	Private Sub ApplicationTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationTitle.Click

	End Sub






	Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

	End Sub
End Class
 
Not really sure where my VB6 stuff goes in your .net,lol.

VB6
Code:
Dim Counter As Byte

Private Sub Form_Load()
Counter = 0
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Counter = Counter + 1
If Counter = 5 Then 'Replace 5 with the amount of seconds you want the splash to show
frmSplash.Visible = Flase 'Replace frmSplash with whatevr you called your splash screen
frmMain.Visible = True    ' Replace frmMain with whatever form you want to go to after your splash
End If
End Sub

This is for VB6(didn't read you wanted in for VB.net till after) but i would imagine it's almost the same for VB.net or at least the same consept.
 
Back
Top Bottom