Fixes/Workarounds | Suhail Kaleem


RemovePreviousVersions not working


In visual studio 2010 while creating setup package when you select RemovePreviousVersions = true

even then the old application installed is not removed  in order to fix that

save the below vbs code in project directory

Dim objInstaller
 Dim objDatabase
 Dim objView
 Dim objResult

Dim strPathMsi

If WScript.Arguments.Count <> 1 Then
 WScript.Echo "Usage: cscript fixRemovePreviousVersions.vbs "
 WScript.Quit -1
 End If

strPathMsi = WScript.Arguments(0)

Set objInstaller = CreateObject("WindowsInstaller.Installer")
 Set objDatabase = objInstaller.OpenDatabase(strPathMsi, 1)
 Set objView = objDatabase.OpenView("UPDATE InstallExecuteSequence SET Sequence=1450 WHERE Action='RemoveExistingProducts'")

WScript.Echo "Patching install sequence: UPDATE InstallExecuteSequence SET Sequence=1450 WHERE Action='RemoveExistingProducts'"

WScript.Quit 0

save the file with name  fixRemovePreviousVersions.vbs

now in vs 2010 set PostBuildEvent  to  cscript “$(ProjectDir)fixRemovePreviousVersions.vbs $(BuiltOuputPath)”

PostBuildEvent  can be found in setup project properties

Now build you msi and it will patch the msi and now the previous installed version will be removed.

“Object expected” error in IE. when using $(document).ready(function()


To fix this

check  the jquery script tag , if it is like

<script  type="text/javascript" src=""></script>

replace it like

<script language="javascript" src=""></script>

and the error goes away

why IE gives the error on type=”text/javascript” i really do not know

if any one know the reason do let me know

Form covers taskbar when maximized


if you are using a title less / border less form  or FormBorderStyle.None then your form when maximized will cover the task bar

if you want the title less form to just expand  to working area of the screen and exclude the task bar then you need to set the maximum size of the form like

Me.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size

also this will work for primary screen will not work in dual screen setup

Go to Top