Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
GeneralRe: do anyone have codes for sql 2005 for saving picture? Pin
Pete O'Hanlon24-Jun-10 4:21
mvePete O'Hanlon24-Jun-10 4:21 
AnswerRe: do anyone have codes for sql 2005 for saving picture? Pin
yu-jian27-Jun-10 9:18
yu-jian27-Jun-10 9:18 
QuestionHow to make a part of the text as superscript in button text Pin
NarVish23-Jun-10 21:40
NarVish23-Jun-10 21:40 
AnswerRe: How to make a part of the text as superscript in button text Pin
Pete O'Hanlon23-Jun-10 22:07
mvePete O'Hanlon23-Jun-10 22:07 
Questionhow to allign the image at the left corner..... Pin
Nivas8223-Jun-10 20:42
Nivas8223-Jun-10 20:42 
GeneralRe: how to allign the image at the left corner..... Pin
Nivas8223-Jun-10 21:16
Nivas8223-Jun-10 21:16 
QuestionHow to display excel sheet inside a windows form Pin
vineesh v23-Jun-10 20:28
vineesh v23-Jun-10 20:28 
QuestionLatency Meter Pin
satsumatable23-Jun-10 19:20
satsumatable23-Jun-10 19:20 
AnswerRe: Latency Meter Pin
DaveAuld23-Jun-10 20:09
professionalDaveAuld23-Jun-10 20:09 
QuestionInsert dataset into database Pin
shoubi23-Jun-10 16:31
shoubi23-Jun-10 16:31 
AnswerRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 17:39
mvePIEBALDconsult23-Jun-10 17:39 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 17:43
shoubi23-Jun-10 17:43 
GeneralRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 17:57
mvePIEBALDconsult23-Jun-10 17:57 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 18:07
shoubi23-Jun-10 18:07 
GeneralRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 18:17
mvePIEBALDconsult23-Jun-10 18:17 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 19:21
shoubi23-Jun-10 19:21 
Questiongetting the local port as netstat in C# + small doubt on network connection Pin
manustone23-Jun-10 9:37
manustone23-Jun-10 9:37 
AnswerMessage Closed Pin
23-Jun-10 20:49
stancrm23-Jun-10 20:49 
GeneralRe: getting the local port as netstat in C# + small doubt on network connection Pin
manustone23-Jun-10 22:02
manustone23-Jun-10 22:02 
Question[newbie] EventLog log = new EventLog() does not work within catch {} block Pin
jon-8023-Jun-10 5:44
professionaljon-8023-Jun-10 5:44 
I'm trying to run this code within Visual Studio 2010, however, having set a breakpoint at line 39, the execution does not seem to get to line 39 where I have set a break point. As a matter of fact, when checking under Visual Studio 2010 Server Explorer > Servers > {puter name} > Application > ASP.NET 4.0.30319.0, there are no relevant events written. I also tried checking within the Windows Event Viewer. For Win XP (Control Panel > Administrative Tools > Event Viewer > Application sub node).

Is this a bug with .NET 4 or Visual Studio 2010? Does this issue happen to anyone else?

Confused | :confused:


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Diagnostics;

public partial class ErrorTestLog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void cmdCompute_Click(object sender, EventArgs e)
    {
        try
        {
            decimal a, b, result;
            a = Decimal.Parse(txtA.Text);
            b = Decimal.Parse(txtB.Text);
            result = a / b;
            lblResult.Text = result.ToString();
            lblResult.ForeColor = Color.Black;
        }
        catch (Exception err)
        {
            lblResult.Text = "<b>Message:</b> " + err.Message + "<br /><br />";
            lblResult.Text += "<b>Source:</b> " + err.Source + "<br /><br />";
            lblResult.Text += "<b>Stack Trace:</b> " + err.StackTrace;
            lblResult.ForeColor = Color.Red;

            // Write the information to the event log.
            EventLog log = new EventLog();
            log.Source = "DivisionPage";
            log.WriteEntry(err.Message, EventLogEntryType.Error);
        }


    }
}


NOTE:
1. Beginning ASP.NET 3.5 in C# in 2008 - From Novice to Professional (ISBN: 978-1-59059-891-7) P.268 (306)
Jon

AnswerRe: [newbie] EventLog log = new EventLog() does not work within catch {} block Pin
Ennis Ray Lynch, Jr.23-Jun-10 5:59
Ennis Ray Lynch, Jr.23-Jun-10 5:59 
GeneralRe: [newbie] EventLog log = new EventLog() does not work within catch {} block Pin
jon-8023-Jun-10 6:23
professionaljon-8023-Jun-10 6:23 
AnswerRe: [newbie] EventLog log = new EventLog() does not work within catch {} block Pin
Abhinav S23-Jun-10 6:01
Abhinav S23-Jun-10 6:01 
GeneralRe: [newbie] EventLog log = new EventLog() does not work within catch {} block Pin
jon-8024-Jun-10 1:01
professionaljon-8024-Jun-10 1:01 
QuestionDirect X 9 from XNA? Pin
venomation23-Jun-10 5:25
venomation23-Jun-10 5:25 

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.