Loading Forms w/Code

J

Joshua Kendall

I need to know the code to load another form. In vb6 it's
simply "load" what is it in dotnet?

Anyway here's my code:

Public Class Splash
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form
Designer.
InitializeComponent()

'Add any initialization after the
InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component
list.
Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the
Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents SplashIMG As
System.Windows.Forms.PictureBox
Friend WithEvents SplashTimer As
System.Windows.Forms.Timer
<System.Diagnostics.DebuggerStepThrough()> Private
Sub InitializeComponent()
Me.components = New
System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager
= New System.Resources.ResourceManager(GetType(Splash))
Me.SplashIMG = New System.Windows.Forms.PictureBox
()
Me.SplashTimer = New System.Windows.Forms.Timer
(Me.components)
Me.SuspendLayout()
'
'SplashIMG
'
Me.SplashIMG.Image = CType(resources.GetObject
("SplashIMG.Image"), System.Drawing.Bitmap)
Me.SplashIMG.Name = "SplashIMG"
Me.SplashIMG.Size = New System.Drawing.Size(600,
300)
Me.SplashIMG.TabIndex = 0
Me.SplashIMG.TabStop = False
'
'SplashTimer
'
Me.SplashTimer.Enabled = True
Me.SplashTimer.Interval = 1000
'
'Splash
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(600, 300)
Me.Controls.AddRange(New
System.Windows.Forms.Control() {Me.SplashIMG})
Me.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.None
Me.Name = "Splash"
Me.ShowInTaskbar = False
Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "KS.IntraNet"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub SplashIMG_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SplashIMG.Click

End Sub

Private Sub Timer1_Tick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SplashTimer.Tick
load (login)
End Sub
End Class

Thanks,

Joshua Kendall
 
F

Fergus Cooney

Hi Joshua,

It's easier for everyone if you post each part as a reply to the
previous rather than a new thread - keeps it all together. ;-)

It's almost as easy as in VB6. First you have to create the Form
and then you can display it.

Sub Timer ...
Dim frmLogin As New Login
frmLogin.Show
End Sub

The first line will call the constructor in Login (Sub New).
The second line will call Sub Login_Load if it has one.

Regards,
Fergus
 
A

Armin Zingler

Joshua Kendall said:
I need to know the code to load another form. In vb6 it's
simply "load" what is it in dotnet?

Why do you need to load it without showing it? Maybe you want to create it
without showing it? If you do, you can put the code in the constructor. If
you need to execute the code only the first time the Form is shown, you can
put it in the Load event.
 
H

Herfried K. Wagner [MVP]

* "Joshua Kendall said:
I need to know the code to load another form. In vb6 it's
simply "load" what is it in dotnet?

We can see your other "instance" of the post...

;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top