Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
Questiontying an event to dynamically created radio buttons [Solved] Pin
Wamuti3-Feb-10 22:38
Wamuti3-Feb-10 22:38 
AnswerRe: tying an event to dynamically created radio buttons Pin
Zar Ni3-Feb-10 22:57
Zar Ni3-Feb-10 22:57 
AnswerRe: tying an event to dynamically created radio buttons Pin
Luc Pattyn4-Feb-10 0:14
sitebuilderLuc Pattyn4-Feb-10 0:14 
Questioncreate LogError file(C# Coding) [modified] for WindowsApplication Pin
jojoba20103-Feb-10 22:06
jojoba20103-Feb-10 22:06 
AnswerRe: create LogError file(C# Coding) Pin
Zar Ni3-Feb-10 22:16
Zar Ni3-Feb-10 22:16 
QuestionRe: create LogError file(C# Coding) Pin
jojoba20103-Feb-10 22:38
jojoba20103-Feb-10 22:38 
AnswerRe: create LogError file(C# Coding) Pin
Zar Ni3-Feb-10 22:42
Zar Ni3-Feb-10 22:42 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Wamuti3-Feb-10 23:00
Wamuti3-Feb-10 23:00 
You are being helped. log4net is a tool to help the programmer output log statements to a variety of output targets.

http://logging.apache.org/log4net/[^]

If you want to re invent the wheel you can create a log file, for example, mylogger.logx using the StreamWriter class maybe like this:

public void Log(string Err)
        {
            using (StreamWriter sw = new StreamWriter("log.txt", true))
            {
                sw.WriteLine();
                sw.WriteLine();
                sw.WriteLine("NEW LOG");
                sw.WriteLine("-------------------");
                sw.WriteLine();
                sw.WriteLine();
                sw.Write("The date is: ");
                sw.WriteLine(DateTime.Now);
                sw.WriteLine();
                sw.WriteLine();
                sw.WriteLine("-------------------");
                sw.WriteLine();
                sw.WriteLine(Err);
            }
        }

Then,


jojoba2010 wrote:
Error Name :



assuming you caught the exception in the catch block like this
catch (Exception ex)
           {
               Log(ex.Message.ToString());
           }



jojoba2010 wrote:
Form Name:


Log(this.Text);



jojoba2010 wrote:
Function Name that error occurred :


Log(ex.Source);



jojoba2010 wrote:
Date_Time when error occurred :


The Log function can already do that.

Read about Exception and see the many things you can know about an exception that has occured!

Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.

QuestionRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
jojoba20103-Feb-10 23:55
jojoba20103-Feb-10 23:55 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Luc Pattyn4-Feb-10 0:18
sitebuilderLuc Pattyn4-Feb-10 0:18 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Zar Ni4-Feb-10 13:41
Zar Ni4-Feb-10 13:41 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Pr@teek B@h!5-Feb-10 3:37
Pr@teek B@h!5-Feb-10 3:37 
QuestionDatagridview Focus to specific cell Pin
Vijjuuu.3-Feb-10 21:02
Vijjuuu.3-Feb-10 21:02 
AnswerRe: Datagridview Focus to specific cell Pin
Eddy Vluggen3-Feb-10 21:34
professionalEddy Vluggen3-Feb-10 21:34 
GeneralRe: Datagridview Focus to specific cell Pin
Vijjuuu.4-Feb-10 1:11
Vijjuuu.4-Feb-10 1:11 
GeneralRe: Datagridview Focus to specific cell Pin
Eddy Vluggen4-Feb-10 1:32
professionalEddy Vluggen4-Feb-10 1:32 
GeneralRe: Datagridview Focus to specific cell Pin
Vijjuuu.4-Feb-10 2:09
Vijjuuu.4-Feb-10 2:09 
QuestionImage opacity in C# Pin
VCsamir3-Feb-10 20:45
VCsamir3-Feb-10 20:45 
AnswerRe: Image opacity in C# Pin
Nuri Ismail3-Feb-10 21:29
Nuri Ismail3-Feb-10 21:29 
GeneralRe: Image opacity in C# Pin
VCsamir3-Feb-10 23:09
VCsamir3-Feb-10 23:09 
GeneralRe: Image opacity in C# Pin
Nuri Ismail3-Feb-10 23:16
Nuri Ismail3-Feb-10 23:16 
QuestionCompare two strings with different fonts Pin
huonghue3-Feb-10 17:17
huonghue3-Feb-10 17:17 
AnswerRe: Compare two strings with different fonts Pin
huonghue3-Feb-10 19:09
huonghue3-Feb-10 19:09 
AnswerRe: Compare two strings with different fonts Pin
Roger Wright3-Feb-10 19:33
professionalRoger Wright3-Feb-10 19:33 
GeneralRe: Compare two strings with different fonts Pin
huonghue4-Feb-10 13:26
huonghue4-Feb-10 13:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.