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

Exe takes more than 35 sec. to load
poodle
allandippy
By default applications deployed using ClickOnce checks for updates from the deployment server(typically a server in the intranet) everytime it launches.
johnvarney
Mayero
André Scaravelli
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.
Txghia58
Is this a click once deployed application That can slow initial startup.
sas9491
There is no way possible to answer this question based in the information you have provided.
PSDCHD
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 Frmlogin 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) Thencomponents.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 PictureBox2 As System.Windows.Forms.PictureBox Friend WithEvents lblversion As System.Windows.Forms.Label Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents btnCancel As System.Windows.Forms.Button Friend WithEvents btnlogin As System.Windows.Forms.Button Friend WithEvents txtDB As System.Windows.Forms.TextBox Friend WithEvents txtServer As System.Windows.Forms.TextBox Friend WithEvents txtPassword As System.Windows.Forms.TextBox Friend WithEvents txtuserid As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Panel1 As System.Windows.Forms.Panel Friend 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.PictureBox Me.lblversion = New System.Windows.Forms.Label Me.Label8 = New System.Windows.Forms.Label Me.Label7 = New System.Windows.Forms.Label Me.Label5 = New System.Windows.Forms.Label Me.btnCancel = New System.Windows.Forms.Button Me.btnlogin = New System.Windows.Forms.Button Me.txtDB = New System.Windows.Forms.TextBox Me.txtServer = New System.Windows.Forms.TextBox Me.txtPassword = New System.Windows.Forms.TextBox Me.txtuserid = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.Panel1 = New System.Windows.Forms.Panel Me.PictureBox1 = New System.Windows.Forms.PictureBox CType(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 = 15 Me.PictureBox2.TabStop = False ' 'lblversion ' Me.lblversion.BackColor = System.Drawing.Color.PapayaWhip Me.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.Firebrick Me.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 = True Me.Label8.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.Label8.Location = New System.Drawing.Point(24, 80) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(270, 14) Me.Label8.TabIndex = 14 Me.Label8.Text = "Please enter your Login and Password :" ' 'Label7 ' Me.Label7.AutoSize = True Me.Label7.BackColor = System.Drawing.Color.PapayaWhip Me.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.SandyBrown Me.Label7.Location = New System.Drawing.Point(16, 40) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(295, 34) Me.Label7.TabIndex = 13 Me.Label7.Text = "HAVE A NICE DAY" ' 'Label5 ' Me.Label5.BackColor = System.Drawing.Color.PapayaWhip Me.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.Firebrick Me.Label5.Location = New System.Drawing.Point(104, 0) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(136, 23) Me.Label5.TabIndex = 11 Me.Label5.Text = "RAM DAS" ' 'btnCancel ' Me.btnCancel.BackColor = System.Drawing.Color.NavajoWhite Me.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.Black Me.btnCancel.Location = New System.Drawing.Point(223, 188) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.TabIndex = 9 Me.btnCancel.Text = "&Cancel" Me.btnCancel.UseVisualStyleBackColor = False ' 'btnlogin ' Me.btnlogin.BackColor = System.Drawing.Color.NavajoWhite Me.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.Black Me.btnlogin.Location = New System.Drawing.Point(143, 188) Me.btnlogin.Name = "btnlogin" Me.btnlogin.Size = New System.Drawing.Size(75, 23) Me.btnlogin.TabIndex = 8 Me.btnlogin.Text = "&OK" Me.btnlogin.UseVisualStyleBackColor = False ' 'txtDB ' Me.txtDB.BackColor = System.Drawing.Color.OldLace Me.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 = 7 Me.txtDB.Text = "dka" Me.txtDB.Visible = False ' 'txtServer ' Me.txtServer.BackColor = System.Drawing.Color.OldLace Me.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.OldLace Me.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.OldLace Me.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 = True Me.Label4.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.Label4.Location = New System.Drawing.Point(16, 176) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(123, 16) Me.Label4.TabIndex = 3 Me.Label4.Text = "Database Name" Me.Label4.Visible = False ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.Label3.Location = New System.Drawing.Point(40, 152) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(102, 16) Me.Label3.TabIndex = 2 Me.Label3.Text = "Server Name" Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.Label2.Location = New System.Drawing.Point(64, 128) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(78, 16) Me.Label2.TabIndex = 1 Me.Label2.Text = "Password" Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.Label1.Location = New System.Drawing.Point(96, 104) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(47, 16) Me.Label1.TabIndex = 0 Me.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 = 0 Me.PictureBox1.TabStop = False ' 'Frmlogin ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.BackColor = System.Drawing.Color.PapayaWhip Me.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.Black Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.Name = "Frmlogin" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.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:48 Private Sub Frmlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Me.Cursor = Cursors.WaitCursor Dim temp As String Dim holds() As String 'Dim holdsNew() As String 'Dim f As File Dim writer As StreamWriter Dim reader As StreamReader If 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 = False Me.StartPosition = FormStartPosition.CenterScreenServer = Trim(txtServer.Text)
DataBaseName = Trim(txtDB.Text)
Dim x As Stringx = VersionNo
Dim myassembly As System.Reflection.Assembly Dim 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 : " & VersionNo Me.Cursor = Cursors.Default Catch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace) End Try End Sub Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click Try Me.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.SqlCommand Dim 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 File Dim 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 If Me.Cursor = Cursors.Default Catch ex As ExceptionMsgBox(ex.Message)
' StoreErrorLog("frmlogin", ex.Message, ex.StackTrace) End Try End Sub Private Sub txtPassword_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPassword.KeyPress Try If Asc(e.KeyChar) = 13 Thenbtnlogin_Click(e, e)
ElseIf Asc(e.KeyChar) = 8 Then Dim i As Integer = Len(txtPassword.Text) - 1 If i < 0 Then 'If at start position itself Exit Sub End IftxtPassword.Text.Remove(i, 1)
Exit Sub End If Catch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace) End Try End Sub Private Sub txtuserid_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtuserid.KeyPress Try If Asc(e.KeyChar) = 32 Thentxtuserid.Text.Insert(Len(txtuserid.Text) - 1,
" ") Exit Sub End If If Asc(e.KeyChar) = 13 ThentxtPassword.Focus()
Exit Sub ElseIf Asc(e.KeyChar) = 8 Then Dim i As Integer = Len(txtuserid.Text) - 1 If i < 0 Then 'If at start position itself Exit Sub End Iftxtuserid.Text.Remove(i, 1)
Exit Sub End If If Not Char.IsLetter(e.KeyChar) Thene.Handled =
TrueMsgBox(
"User Name cannot contain invalid characters or numbers", MsgBoxStyle.Information)txtuserid.Focus()
End If Catch ex As ExceptionMsgBox(ex.Message)
StoreErrorLog(
"frmlogin", ex.Message, ex.StackTrace) End Try End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click End End Sub
Private Sub txtServer_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtServer.KeyPress If Asc(e.KeyChar) = 13 Thenbtnlogin_Click(e, e)
End If End SubEnd
Class