Exe takes more than 35 sec. to load
Hi freinds,
I am using vb.net 2005. The problem is when i install the project on the clients PC it take more that 30-40 sec to load. Why does it takes so much time as compared to vb 6 applications. Is there any other way to improve the performance Please Help me out.
Thanks
Puneet Minda
Puneet
I think what ReneeC is saying is that a 35sec load time is not typical. It is likely something specific that you are doing in your application. To get the help you need, you might want to describe your application a little better. After such time, one of these brilliant folks (like Renee) might be able to help you.
HI friends,
well i am giving u the code of my login form which is the start up form. I have arround 150 form in the application.
The application Imports the following name spaces:
Microsoft.Visualbasic
System
System.Collection
system.Data
System.Diagnostics
System.Drawing
System.windows.forms
I hope this may give u the information about my application. if u want to know anything more please let me know.
Imports
System.IOImports
System.Data.SqlClientPublic
Class FrmloginInherits 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() callEnd Sub'Form overrides dispose to clean up the component list.Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)If disposing ThenIf Not (components Is Nothing) Thencomponents.Dispose()
End IfEnd IfMyBase.Dispose(disposing)End Sub'Required by the Windows Form DesignerPrivate 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 PictureBox2 As System.Windows.Forms.PictureBoxFriend WithEvents lblversion As System.Windows.Forms.LabelFriend WithEvents Label8 As System.Windows.Forms.LabelFriend WithEvents Label7 As System.Windows.Forms.LabelFriend WithEvents Label5 As System.Windows.Forms.LabelFriend WithEvents btnCancel As System.Windows.Forms.ButtonFriend WithEvents btnlogin As System.Windows.Forms.ButtonFriend WithEvents txtDB As System.Windows.Forms.TextBoxFriend WithEvents txtServer As System.Windows.Forms.TextBoxFriend WithEvents txtPassword As System.Windows.Forms.TextBoxFriend WithEvents txtuserid As System.Windows.Forms.TextBoxFriend WithEvents Label4 As System.Windows.Forms.LabelFriend WithEvents Label3 As System.Windows.Forms.LabelFriend WithEvents Label2 As System.Windows.Forms.LabelFriend WithEvents Label1 As System.Windows.Forms.LabelFriend WithEvents Panel1 As System.Windows.Forms.PanelFriend WithEvents PictureBox1 As System.Windows.Forms.PictureBox<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Frmlogin))Me.PictureBox2 = New System.Windows.Forms.PictureBoxMe.lblversion = New System.Windows.Forms.LabelMe.Label8 = New System.Windows.Forms.LabelMe.Label7 = New System.Windows.Forms.LabelMe.Label5 = New System.Windows.Forms.LabelMe.btnCancel = New System.Windows.Forms.ButtonMe.btnlogin = New System.Windows.Forms.ButtonMe.txtDB = New System.Windows.Forms.TextBoxMe.txtServer = New System.Windows.Forms.TextBoxMe.txtPassword = New System.Windows.Forms.TextBoxMe.txtuserid = New System.Windows.Forms.TextBoxMe.Label4 = New System.Windows.Forms.LabelMe.Label3 = New System.Windows.Forms.LabelMe.Label2 = New System.Windows.Forms.LabelMe.Label1 = New System.Windows.Forms.LabelMe.Panel1 = New System.Windows.Forms.PanelMe.PictureBox1 = New System.Windows.Forms.PictureBoxCType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()Me.Panel1.SuspendLayout()CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()Me.SuspendLayout()''PictureBox2'Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image)Me.PictureBox2.Location = New System.Drawing.Point(0, 0)Me.PictureBox2.Name = "PictureBox2"Me.PictureBox2.Size = New System.Drawing.Size(200, 256)Me.PictureBox2.TabIndex = 15Me.PictureBox2.TabStop = False''lblversion'Me.lblversion.BackColor = System.Drawing.Color.PapayaWhipMe.lblversion.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.lblversion.ForeColor = System.Drawing.Color.FirebrickMe.lblversion.Location = New System.Drawing.Point(120, 24)Me.lblversion.Name = "lblversion"Me.lblversion.Size = New System.Drawing.Size(156, 23)Me.lblversion.TabIndex = 12''Label8'Me.Label8.AutoSize = TrueMe.Label8.BackColor = System.Drawing.Color.PapayaWhipMe.Label8.Font = New System.Drawing.Font("Verdana", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label8.ForeColor = System.Drawing.Color.BlackMe.Label8.Location = New System.Drawing.Point(24, 80)Me.Label8.Name = "Label8"Me.Label8.Size = New System.Drawing.Size(270, 14)Me.Label8.TabIndex = 14Me.Label8.Text = "Please enter your Login and Password :"''Label7'Me.Label7.AutoSize = TrueMe.Label7.BackColor = System.Drawing.Color.PapayaWhipMe.Label7.Font = New System.Drawing.Font("Georgia", 21.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label7.ForeColor = System.Drawing.Color.SandyBrownMe.Label7.Location = New System.Drawing.Point(16, 40)Me.Label7.Name = "Label7"Me.Label7.Size = New System.Drawing.Size(295, 34)Me.Label7.TabIndex = 13Me.Label7.Text = "HAVE A NICE DAY"''Label5'Me.Label5.BackColor = System.Drawing.Color.PapayaWhipMe.Label5.Font = New System.Drawing.Font("Georgia", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label5.ForeColor = System.Drawing.Color.FirebrickMe.Label5.Location = New System.Drawing.Point(104, 0)Me.Label5.Name = "Label5"Me.Label5.Size = New System.Drawing.Size(136, 23)Me.Label5.TabIndex = 11Me.Label5.Text = "RAM DAS"''btnCancel'Me.btnCancel.BackColor = System.Drawing.Color.NavajoWhiteMe.btnCancel.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.btnCancel.ForeColor = System.Drawing.Color.BlackMe.btnCancel.Location = New System.Drawing.Point(223, 188)Me.btnCancel.Name = "btnCancel"Me.btnCancel.Size = New System.Drawing.Size(75, 23)Me.btnCancel.TabIndex = 9Me.btnCancel.Text = "&Cancel"Me.btnCancel.UseVisualStyleBackColor = False''btnlogin'Me.btnlogin.BackColor = System.Drawing.Color.NavajoWhiteMe.btnlogin.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.btnlogin.ForeColor = System.Drawing.Color.BlackMe.btnlogin.Location = New System.Drawing.Point(143, 188)Me.btnlogin.Name = "btnlogin"Me.btnlogin.Size = New System.Drawing.Size(75, 23)Me.btnlogin.TabIndex = 8Me.btnlogin.Text = "&OK"Me.btnlogin.UseVisualStyleBackColor = False''txtDB'Me.txtDB.BackColor = System.Drawing.Color.OldLaceMe.txtDB.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.txtDB.Location = New System.Drawing.Point(144, 176)Me.txtDB.Name = "txtDB"Me.txtDB.Size = New System.Drawing.Size(176, 23)Me.txtDB.TabIndex = 7Me.txtDB.Text = "dka"Me.txtDB.Visible = False''txtServer'Me.txtServer.BackColor = System.Drawing.Color.OldLaceMe.txtServer.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.txtServer.Location = New System.Drawing.Point(144, 152)Me.txtServer.Name = "txtServer"Me.txtServer.Size = New System.Drawing.Size(176, 23)Me.txtServer.TabIndex = 6''txtPassword'Me.txtPassword.BackColor = System.Drawing.Color.OldLaceMe.txtPassword.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.txtPassword.Location = New System.Drawing.Point(144, 128)Me.txtPassword.Name = "txtPassword"Me.txtPassword.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)Me.txtPassword.Size = New System.Drawing.Size(176, 23)Me.txtPassword.TabIndex = 5''txtuserid'Me.txtuserid.BackColor = System.Drawing.Color.OldLaceMe.txtuserid.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.txtuserid.Location = New System.Drawing.Point(144, 104)Me.txtuserid.Name = "txtuserid"Me.txtuserid.Size = New System.Drawing.Size(176, 23)Me.txtuserid.TabIndex = 4''Label4'Me.Label4.AutoSize = TrueMe.Label4.BackColor = System.Drawing.Color.PapayaWhipMe.Label4.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label4.ForeColor = System.Drawing.Color.BlackMe.Label4.Location = New System.Drawing.Point(16, 176)Me.Label4.Name = "Label4"Me.Label4.Size = New System.Drawing.Size(123, 16)Me.Label4.TabIndex = 3Me.Label4.Text = "Database Name"Me.Label4.Visible = False''Label3'Me.Label3.AutoSize = TrueMe.Label3.BackColor = System.Drawing.Color.PapayaWhipMe.Label3.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label3.ForeColor = System.Drawing.Color.BlackMe.Label3.Location = New System.Drawing.Point(40, 152)Me.Label3.Name = "Label3"Me.Label3.Size = New System.Drawing.Size(102, 16)Me.Label3.TabIndex = 2Me.Label3.Text = "Server Name"Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopRight''Label2'Me.Label2.AutoSize = TrueMe.Label2.BackColor = System.Drawing.Color.PapayaWhipMe.Label2.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label2.ForeColor = System.Drawing.Color.BlackMe.Label2.Location = New System.Drawing.Point(64, 128)Me.Label2.Name = "Label2"Me.Label2.Size = New System.Drawing.Size(78, 16)Me.Label2.TabIndex = 1Me.Label2.Text = "Password"Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight''Label1'Me.Label1.AutoSize = TrueMe.Label1.BackColor = System.Drawing.Color.PapayaWhipMe.Label1.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.Label1.ForeColor = System.Drawing.Color.BlackMe.Label1.Location = New System.Drawing.Point(96, 104)Me.Label1.Name = "Label1"Me.Label1.Size = New System.Drawing.Size(47, 16)Me.Label1.TabIndex = 0Me.Label1.Text = "Login"Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopRight''Panel1'Me.Panel1.Controls.Add(Me.btnCancel)Me.Panel1.Controls.Add(Me.btnlogin)Me.Panel1.Controls.Add(Me.Label5)Me.Panel1.Controls.Add(Me.lblversion)Me.Panel1.Controls.Add(Me.Label7)Me.Panel1.Controls.Add(Me.Label8)Me.Panel1.Controls.Add(Me.Label1)Me.Panel1.Controls.Add(Me.txtDB)Me.Panel1.Controls.Add(Me.txtServer)Me.Panel1.Controls.Add(Me.txtPassword)Me.Panel1.Controls.Add(Me.txtuserid)Me.Panel1.Controls.Add(Me.Label4)Me.Panel1.Controls.Add(Me.Label3)Me.Panel1.Controls.Add(Me.Label2)Me.Panel1.Location = New System.Drawing.Point(200, 8)Me.Panel1.Name = "Panel1"Me.Panel1.Size = New System.Drawing.Size(336, 240)Me.Panel1.TabIndex = 16''PictureBox1'Me.PictureBox1.Location = New System.Drawing.Point(320, 240)Me.PictureBox1.Name = "PictureBox1"Me.PictureBox1.Size = New System.Drawing.Size(176, 8)Me.PictureBox1.TabIndex = 0Me.PictureBox1.TabStop = False''Frmlogin'Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)Me.BackColor = System.Drawing.Color.PapayaWhipMe.ClientSize = New System.Drawing.Size(538, 255)Me.Controls.Add(Me.PictureBox1)Me.Controls.Add(Me.PictureBox2)Me.Controls.Add(Me.Panel1)Me.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))Me.ForeColor = System.Drawing.Color.BlackMe.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialogMe.MaximizeBox = FalseMe.Name = "Frmlogin"Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreenMe.Text = "Login Screen (Beta - 08/10/05)"CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()Me.Panel1.ResumeLayout(False)Me.Panel1.PerformLayout()CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()Me.ResumeLayout(False)End Sub#
End Region'date 01/09/06 13:48Private Sub Frmlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadTryMe.Cursor = Cursors.WaitCursorDim temp As StringDim holds() As String'Dim holdsNew() As String'Dim f As FileDim writer As StreamWriterDim reader As StreamReaderIf Not File.Exists("server.txt") Thenwriter = File.CreateText(
"server.txt")writer.Close()
End Ifreader = File.OpenText(
"server.txt")temp = reader.ReadToEnd
If Len(Trim(temp)) > 0 Then 'If File exists and has dataholds = Split(Trim(Trim(temp)),
" ")txtServer.Text = holds(0)
txtDB.Text = Trim(holds(1))
'DataBaseName = Trim(holds(1))'holdsNew = Split(Trim(DataBaseName), Chr(13))'DataBaseName = "'" & RTrim(holdsNew(0)) & "'"'If InStr(1, DataBaseName, Chr(13)) Then'MsgBox(Len(DataBaseName))'DataBaseName = holdsNew(0)'DataBaseName = Mid(DataBaseName, 1, 3)'Else' DataBaseName = Trim(holds(1))End Ifreader.Close()
'Me.Icon = New Icon("dk.ico")Me.CausesValidation = FalseMe.StartPosition = FormStartPosition.CenterScreenServer = Trim(txtServer.Text)
DataBaseName = Trim(txtDB.Text)
Dim x As Stringx = VersionNo
Dim myassembly As System.Reflection.AssemblyDim appver As System.Versionmyassembly = System.Reflection.Assembly.GetExecutingAssembly()
appver = myassembly.GetName.Version
VersionNo = appver.Major.ToString() +
"." + appver.Minor.ToString() + "." + appver.Build.ToString()lblversion.Text =
"Version : " & VersionNoMe.Cursor = Cursors.DefaultCatch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace)End TryEnd SubPrivate Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.ClickTryMe.Cursor = Cursors.WaitCursorConnectionUserName =
"puneet"ConnectionPassword =
"puneet"con.ConnectionString = Trim(
"user id='" & Trim(ConnectionUserName) & "';password='" & Trim(ConnectionPassword) & "';data source='" & Trim(txtServer.Text) & "';initial catalog=" & RTrim(DataBaseName))Dim comm As SqlClient.SqlCommand = New SqlClient.SqlCommandDim p1 As SqlClient.SqlParameter = comm.Parameters.Add("@user", SqlDbType.NVarChar, 50)Dim p2 As SqlClient.SqlParameter = comm.Parameters.Add("@pass", SqlDbType.NVarChar, 50)Dim count As IntegerServer = txtServer.Text
DataBaseName = txtDB.Text
p1.Value = txtuserid.Text
p2.Value = txtPassword.Text
' adduser = txtuserid.Text' edituser = txtuserid.Textcomm.Connection = con
comm.CommandType = CommandType.StoredProcedure
comm.CommandText =
"login"adap.SelectCommand = comm
'Dim strQuery As String = "login '" & txtuserid.Text & "','" & txtPassword.Text & "'"'adap = New SqlDataAdapter(strQuery, con) count = adap.Fill(dset,
"Users")If count > 0 Then'Dim f As FileDim writer As StreamWriterwriter = File.CreateText(
"server.txt")writer.WriteLine(txtServer.Text &
" " & txtDB.Text)writer.Close()
' MsgBox("Hello " & dset.Tables("users").Rows(0).Item(0) & " Have A Nice Day(", MsgBoxStyle.Information)")LoginUserSame = dset.Tables(
"Users").Rows(0).Item("LoginName")loginUserPasswordSame = dset.Tables(
"Users").Rows(0).Item("Password")IsADMIN = dset.Tables(
"Users").Rows(0).Item("IsAdmin")ComputerName = System.Net.Dns.GetHostName
''''''Connection string for Publicity Database'''''''DataBaseName1 =
"DKPub1"ConPub.ConnectionString =
"user id='" & Trim(ConnectionUserName) & "';password='" & Trim(ConnectionPassword) & "';data source='" & Trim(txtServer.Text) & "';initial catalog=" & DataBaseName1sServer =
"dka.dbo."'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Connection string for Marc Database(DKCAT)'''''''DataBaseName1 =
"DKMarc"ConMarc.ConnectionString =
"user id='" & Trim(ConnectionUserName) & "';password='" & Trim(ConnectionPassword) & "';data source='" & Trim(txtServer.Text) & "';initial catalog=DKMarc"sServer =
"dka.dbo."'''''''''''''''''''''''''''''''''''''''''''''''''''''''Dim mdiform As New frmmdimdiform.Show()
Me.Hide()' Me.Close()ElseMsgBox(
"User access Denied ; Please Verify Yourself Again", MsgBoxStyle.Information)txtuserid.Text =
""txtPassword.Text =
""txtuserid.Focus()
End IfMe.Cursor = Cursors.DefaultCatch ex As ExceptionMsgBox(ex.Message)
' StoreErrorLog("frmlogin", ex.Message, ex.StackTrace)End TryEnd SubPrivate Sub txtPassword_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPassword.KeyPressTryIf Asc(e.KeyChar) = 13 Thenbtnlogin_Click(e, e)
ElseIf Asc(e.KeyChar) = 8 ThenDim i As Integer = Len(txtPassword.Text) - 1If i < 0 Then 'If at start position itselfExit SubEnd IftxtPassword.Text.Remove(i, 1)
Exit SubEnd IfCatch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace)End TryEnd SubPrivate Sub txtuserid_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtuserid.KeyPressTryIf Asc(e.KeyChar) = 32 Thentxtuserid.Text.Insert(Len(txtuserid.Text) - 1,
" ")Exit SubEnd IfIf Asc(e.KeyChar) = 13 ThentxtPassword.Focus()
Exit SubElseIf Asc(e.KeyChar) = 8 ThenDim i As Integer = Len(txtuserid.Text) - 1If i < 0 Then 'If at start position itselfExit SubEnd Iftxtuserid.Text.Remove(i, 1)
Exit SubEnd IfIf Not Char.IsLetter(e.KeyChar) Thene.Handled =
TrueMsgBox(
"User Name cannot contain invalid characters or numbers", MsgBoxStyle.Information)txtuserid.Focus()
End IfCatch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace)End TryEnd SubPrivate Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.ClickEndEnd SubPrivate Sub txtServer_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtServer.KeyPressIf Asc(e.KeyChar) = 13 Thenbtnlogin_Click(e, e)
End IfEnd SubEnd
Class