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...
Van
ReplyDeleteizmir
Artvin
Tunceli
Eskişehir
WKFİ
yozgat
ReplyDeletetunceli
hakkari
zonguldak
adıyaman
AHNLO
uşak evden eve nakliyat
ReplyDeletebalıkesir evden eve nakliyat
tokat evden eve nakliyat
kayseri evden eve nakliyat
denizli evden eve nakliyat
6VE6İ
2F442
ReplyDeleteUrfa Evden Eve Nakliyat
Samsun Evden Eve Nakliyat
Gümüşhane Parça Eşya Taşıma
Rize Parça Eşya Taşıma
Ankara Parça Eşya Taşıma
A3FBD
ReplyDeleteKarabük Lojistik
Denizli Lojistik
Artvin Lojistik
Samsun Lojistik
İstanbul Evden Eve Nakliyat
1CFB7
ReplyDeleteAydın Evden Eve Nakliyat
Tekirdağ Evden Eve Nakliyat
Düzce Evden Eve Nakliyat
Rize Evden Eve Nakliyat
Muğla Evden Eve Nakliyat
D3AAB
ReplyDeleteMersin Lojistik
Düzce Şehirler Arası Nakliyat
Btcturk Güvenilir mi
Ardahan Şehir İçi Nakliyat
Antep Şehir İçi Nakliyat
Çorum Şehirler Arası Nakliyat
Artvin Parça Eşya Taşıma
Trabzon Şehir İçi Nakliyat
Poloniex Güvenilir mi
A0F38
ReplyDeleteaksaray ücretsiz görüntülü sohbet
en iyi ücretsiz sohbet siteleri
tunceli sesli sohbet sitesi
van görüntülü sohbet canlı
görüntülü sohbet odaları
balıkesir ucretsiz sohbet
balıkesir bedava sohbet siteleri
mardin ücretsiz görüntülü sohbet
rize telefonda görüntülü sohbet
278EB
ReplyDeleteamasya ücretsiz sohbet sitesi
kütahya canlı görüntülü sohbet
çanakkale görüntülü sohbet sitesi
maraş rastgele sohbet odaları
malatya sesli sohbet sitesi
ücretsiz sohbet odaları
aydın canlı görüntülü sohbet
zonguldak en iyi görüntülü sohbet uygulamaları
rastgele görüntülü sohbet
2498C
ReplyDeleteEskişehir Bedava Görüntülü Sohbet Sitesi
telefonda rastgele sohbet
Bayburt Sesli Sohbet Mobil
gümüşhane sesli sohbet sesli chat
hakkari sesli sohbet mobil
diyarbakır ucretsiz sohbet
konya görüntülü sohbet yabancı
görüntülü canlı sohbet
Çanakkale Chat Sohbet
4A537
ReplyDeleteBolu Sohbet Siteleri
giresun ucretsiz sohbet
karabük sohbet odaları
ücretsiz sohbet
mobil sohbet odaları
Tokat Canlı Sohbet
izmir canlı sohbet sitesi
seslı sohbet sıtelerı
rize canli sohbet chat
6CF5B
ReplyDeleteprobit
okex
bibox
kredi kartı ile kripto para alma
paribu
bitcoin haram mı
kripto ne demek
bitget
kucoin
9B944
ReplyDeletebitcoin ne zaman yükselir
4g mobil proxy
bitexen
paribu
telegram kripto kanalları
coinex
btcturk
en az komisyon alan kripto borsası
binance referans kod
0F17B
ReplyDeleteparibu
gate io
bitcoin giriş
https://kapinagelsin.com.tr/
kraken
paribu
telegram kripto para grupları
bingx
copy trade nedir
A7DF3
ReplyDeleteokex
February 2024 Calendar
referans kimligi nedir
probit
bitexen
February 2024 Calendar
bitcoin hesabı nasıl açılır
kripto para telegram
August 2024 Calendar