Thursday, December 27, 2012

Solve: Error while displaying crystal report using visual studio 2010, 2012, 2013

The error message while trying to display crystal report using visual studio 2010
System.IO.FileNotFoundException was unhandled
Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
 FileName=file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll
 FusionLog==== Pre-bind state information ===
 LOG: Where-ref bind. Location = C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll
 LOG: Appbase = file:///D:/S_and_G/LMS_DotNet/LMS_Solution/LMS/bin/Debug/
 LOG: Initial PrivatePath = NULL
 Calling assembly : (Unknown).


Sunday, December 2, 2012

How to: Check if another instance of the application is already running

how it is possible to check whether another instance of the program is running and if so stop the application before loading if there is an existing instance of it.


write at your Main method the following code to quit the method which will kill the currently loading process instantly.

if (System.Diagnostics.Process.GetProcessesByName(
  System.Reflection.Assembly.GetEntryAssembly().Location)).Length > 1)
  MessageBox.Show("Application is already running");

Friday, November 23, 2012

Solve: System.IndexOutOfRangeException on Fire Event DataGridView Rows

Fire any event on DataGridView may appear the following error:

System.IndexOutOfRangeException: Index -1 does not have a value.
    at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
    at System.Windows.Forms.CurrencyManager.get_Current()
    at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)
    at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
    at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
    at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown)
    at System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
    at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
    at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.DataGridView.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Monday, August 6, 2012

Solve: HTTP Error 404.2 - Not Found

The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

  • Open the IIS Manager and navigate to the server level. 

Solve: HTTP Error 404.17 - Not Found

HTTP Error 404.17 - Not Found - Static File Handler

  1. Install .Net Framework4.0 on your IIS server. 
  2. run "aspnet_regiis -i" in "C:\Windows\Microsoft.NET\Framework\v4.0.21006"

Sunday, March 25, 2012

How to: Close Windows form while doing CreateHandle()

The error Value Close() cannot be called while doing CreateHandle() usually happens when we try to close the form in the constructor or Load event.
For example,

the following code gives the error:

private void frmCustomer_Load(object sender, EventArgs e)
if (!Valid())

The Solution:

Thursday, March 22, 2012

How To: Enable Hidden attribute in folder options

To enable to change folder/file hidden attribute in properties option again:   

1. Goto command prompt

  • Click start -> run
  • Type cmd and press enter

2. Change your working directory to driver letter of USB drive, for example type H:

  • In the command window that opens type "cd [drivename]" and press enter
  • Type "dir" and press enter

3. Type the command "attrib /s /d -s -h [file/folder name]" and press enter or type

-r will clear the Read Only Attribute
-s will clear the System file Attribute
-h will clear the Hidden file Attribute
/s will apply above command to all files in working directory
/d will apply above command to all folders in working directory
[foldername] is the name of the folder without the square brackets)