티스토리 뷰
string exceptionLogFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Exception.txt");
private void checkBoxTopMost_CheckedChanged(object sender, EventArgs e)
{
try
{
this.TopMost = this.checkBoxTopMost.Checked;
}
catch (Exception ex)
{
StackFrame fr = new StackFrame(true);
StackTrace st = new StackTrace(fr);
MethodBase mb = fr.GetMethod();
recordExceptionLog(ex, mb.Name, fr.GetFileLineNumber(), st.ToString());
}
}
/// <summary>
/// Record Exception Message to Log File
/// </summary>
private void recordExceptionLog(Exception ex, string methodName, int lineNumber, string stackTraceString)
{
string exMessage = String.Format("{0}{1}\t[{2}:{3}] {4}",
DateTime.Now.ToString(), stackTraceString, methodName, lineNumber, ex.Message);
using (StreamWriter sw = new StreamWriter(exceptionLogFile, true))
{
sw.WriteLine(exMessage);
}
}
private void checkBoxTopMost_CheckedChanged(object sender, EventArgs e)
{
try
{
this.TopMost = this.checkBoxTopMost.Checked;
}
catch (Exception ex)
{
StackFrame fr = new StackFrame(true);
StackTrace st = new StackTrace(fr);
MethodBase mb = fr.GetMethod();
recordExceptionLog(ex, mb.Name, fr.GetFileLineNumber(), st.ToString());
}
}
/// <summary>
/// Record Exception Message to Log File
/// </summary>
private void recordExceptionLog(Exception ex, string methodName, int lineNumber, string stackTraceString)
{
string exMessage = String.Format("{0}{1}\t[{2}:{3}] {4}",
DateTime.Now.ToString(), stackTraceString, methodName, lineNumber, ex.Message);
using (StreamWriter sw = new StreamWriter(exceptionLogFile, true))
{
sw.WriteLine(exMessage);
}
}
'Code > C#' 카테고리의 다른 글
[C#] Windows UI Automation Sample (0) | 2010.04.13 |
---|---|
[C#] indexer sample (0) | 2010.02.23 |
[C#] Shift Operator (0) | 2010.02.17 |
[C#] Register/Unregister ActiveX Control (0) | 2009.03.15 |
[C#] Detect UserControl's Closing (0) | 2009.01.07 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- iText
- AxWebBrowser
- 유틸리티
- java
- autohotkey
- tagREADYSTATE
- iTextSharp
- DotNetMagic
- Phalanger
- download.com
- Regular Expressions
- Rollback Rx
- windows
- jre
- Automation
- registry
- c#
- Microsoft
- 스크린캡쳐
- Sample Code
- WinAutomation
- .net framework
- 애드센스감추기
- ScreenHunter
- 애드센스숨기기
- AdSense감추기
- AdSense숨기기
- Service pack
- READYSTATE_COMPLETE
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함