Thursday, May 8, 2008

Main Form and Splash Screen c# windows application

Splash screen in Visual Studio is a greatway to give user the feedback of loading the application.Problem I faced implementing the Splash Screen is main form always used to hide in the task bar.After doing a couple of searches I found out that spash screen delay time is the culprit.

I made the splash screen to show for few seconds than my main form which gives the focus to the main form that avoids the form staying in the task bar.

In Application Events.vb I added the following

Namespace My
' The following events are availble for MyApplication:
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
'Set the splash screen timeout.
Me.MinimumSplashScreenDisplayTime = 1000
Return MyBase.OnInitialize(commandLineArgs)
End Function
'End code paste
End Class
End Namespace

In the form load is the following code

Dim dt As DateTime = DateTime.Now
Me.WindowState = FormWindowState.Normal
Dim timespaninms As Integer = (DateTime.Now - dt).Milliseconds
''Comment or delete the line below once you get the average load time after 5 or 6 runs.
'MessageBox.Show("Time in MilliSeconds : " + timespaninms.ToString)
If (timespaninms < My.Application.MinimumSplashScreenDisplayTime) Then
My.Application.MinimumSplashScreenDisplayTime = timespaninms
My.Application.SaveMySettingsOnExit = True
timespaninms = My.Application.MinimumSplashScreenDisplayTime - timespaninms
End If

Sunday, May 4, 2008

Visual SourceSafe lost the keyboard when removed the bindings

Sometimes if I want to do lot of changes to my project, I always disconnect my netweok cable and make a copy of my project and open the solution.After opening the solution Visual SourceSafe prompts you to work in disconnected mode, permanently remove bindings or manually remove bindings.If you remove the bindings visual studio seems to lost the keyboard you cannot use any keys in the IDE except the Special Keys.I went ahead and change the readonly setting on the folders and everything works fine after that.

Visual Studio you are lost baby!

IIS Manager Crashes on Load/Start Windows 7, IIS 7.5

IIS Manager Crashes on Start  Windows 7, IIS 7.5, Power Shell 5.1. Here is the error I got in the event viewer. IISMANAGER_CRASH IIS Ma...