Wednesday, 22 March 2017
Unable to set the Freeze Panes property of Window Class C#
It is generally easy to resolve the compile time errors because the reason for the error is probably known but a run time error always hinders the development process for a considerable amount of time so are the exceptions that unknowingly show up from no where. That is why it is always advised to handle each and every exception your application might throw. The only way to be a master in handling exception is experience, yeah you read it right. More you develop, more problem you will encounter in your developing environment and in turn more you will know the reason and the so called timing of the exceptions.
Exception
One of the most encountered is "unable to set freeze panes property of window class" which show up when you try to freeze panes while formatting an excel file in c#.
Reason
The main reason for occurrence of such an exception is incompatibility between older and the newer versions of MS Excel.
When it occirs
This exception occurs when you are using a newer version of MS Excel and your application gets activate in background, I repeat your MS Excel application thread opens in the minimized state which hinders the freezing pane process.
How to counter this exception?
Obviously to get a solution to a problem, first of all understanding the problem is must more precisely the reason of problem should be known. Since we know the reason why freeze panes property is not set and the exception is thrown we can provide a solution.
So if somehow we can make our MS Excel thread open in maximized state or normal state explicitly then bingo we successfully resolved the issue.
Still it is a good practice to surround the exception causing snippet with try block and catch the exception so that there is no exceptional flow change in your application.
Let us look at the source code for the same
Exception
One of the most encountered is "unable to set freeze panes property of window class" which show up when you try to freeze panes while formatting an excel file in c#.
Reason
The main reason for occurrence of such an exception is incompatibility between older and the newer versions of MS Excel.
When it occirs
This exception occurs when you are using a newer version of MS Excel and your application gets activate in background, I repeat your MS Excel application thread opens in the minimized state which hinders the freezing pane process.
How to counter this exception?
Obviously to get a solution to a problem, first of all understanding the problem is must more precisely the reason of problem should be known. Since we know the reason why freeze panes property is not set and the exception is thrown we can provide a solution.
So if somehow we can make our MS Excel thread open in maximized state or normal state explicitly then bingo we successfully resolved the issue.
Still it is a good practice to surround the exception causing snippet with try block and catch the exception so that there is no exceptional flow change in your application.
Unable to Set Freeze Panes Exception |
Let us look at the source code for the same
Source Code
//Maximize the window state before setting freeze panes property
ExcelApp.Application.ActiveWindow.WindowState = Microsoft.Office.Interop.Excel.XlWindowState.xlMinimized;
ExcelApp.Columns.AutoFit();
try
{
ExcelApp.Application.ActiveWindow.FreezePanes = false;
ExcelApp.Application.ActiveWindow.SplitColumn = 1; //To freeze first column
ExcelApp.Application.ActiveWindow.SplitRow = 1; // To freeze Top Row
ExcelApp.Application.ActiveWindow.FreezePanes = true;
}
catch(Exception ex)
{
}
Also Read Troubleshooting Cisco VPN client 0x8004a029 with screenshots
Also Read Troubleshooting ORA-12505
Also Read Troubleshooting ORA-12505
Subscribe to:
Post Comments (Atom)
Search
Popular Posts
-
Troubleshooting Cisco VPN client Before starting troubleshooting, Let us see what VPN is and what it requires to perform its intended f...
-
Evolution-Mobile Phones With the development of portable technology,wireless communication has so evolved that (According to the announce...
-
File Versioning C# File versioning, saving file with unique file name in c# File versioning allows a user to have several versions of ...
-
Text Box Hint in c# Windows Form Application Text Box Hint in c# Windows Form Application While developing a windows form applicat...
-
Unable to set the Freeze Panes property of Window Class C# It is generally easy to resolve the compile time errors because the reason fo...
5CF56
ReplyDeletegörüntülü şov ücretli
CF3A4
ReplyDeletesanal ücretli show
6271E
ReplyDeletecanlı ücretli şov
6FABF
ReplyDeletegörüntülü şov whatsapp numarası
D6885DB300
ReplyDeletegörüntülü show
cam şov
whatsapp ücretli show
görüntülü şov whatsapp numarası
görüntülü şov
telegram görüntülü şov
telegram show
whatsapp görüntülü şov
ücretli show
71DB190A62
ReplyDeletecanli cam show
cam show
görüntülü şov whatsapp numarası
telegram show
canli web cam show
cam şov
ücretli şov
whatsapp görüntülü şov
telegram görüntülü şov
7792469033
ReplyDeletewhatsapp ücretli show
delay
sildegra
stag
cialis
ereksiyon hapı
cobra vega
sinegra
lifta
9E6F726B82
ReplyDeletefx15 zayıflama hapı
skype şov
ücretli şov
whatsapp ücretli show
kaldırıcı hap
kamagra hap
viagra
telegram görüntülü şov
telegram show
DE47648293
ReplyDeletevega
cobra vega
görüntülü şov
sinegra 100 mg
whatsapp görüntülü show güvenilir
görüntülü şov whatsapp numarası
cialis
ereksiyon hapı
telegram show