469,299 Members | 2,078 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,299 developers. It's quick & easy.

Form Loading - Issue With Trapping for Errors

I created a Windows application that is having an odd issue. The application
starts for a split second, but then closes. I cannot get any error messages
to display as to what causes the program to close. Listed below is my
Default_Load method. How would I be able to trap the error so I know what is
causing this form to not load as I do not get any information at this time.
We have it running on 4 different computers, but the one computer won't let
it run. We checked to make sure all the necessary drivers are installed, but
not sure what is conflicting.

private void Default_Load(object sender, EventArgs e)
{
try
{
this.tPCEXPXRFTSTTableAdapter.Fill(this.tPCEXPXRF. TPCEXPXRFTST);
dataGridView1.CellValidating += new
DataGridViewCellValidatingEventHandler
(dataGridView1_CellValidating);
this.dataGridView1.DataError += new DataGridViewDataErrorEventHandler
(dataGridView1_DataError);
}
catch (Exception ex)
{
System.Diagnostics.EventLog log = new
System.Diagnostics.EventLog();
log.Log = "System";
log.Source = "CE Item Lookup Table Editor";
log.WriteEntry(ex.ToString());
}
}
Jun 16 '06 #1
4 2368
It is possible the code in your catch is failing. Might be a security issue,
where the user does not have rights to write to the event log.

Not sure why they would just shut down the app, though

"Andy" <An**@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com...
I created a Windows application that is having an odd issue. The
application
starts for a split second, but then closes. I cannot get any error
messages
to display as to what causes the program to close. Listed below is my
Default_Load method. How would I be able to trap the error so I know what
is
causing this form to not load as I do not get any information at this
time.
We have it running on 4 different computers, but the one computer won't
let
it run. We checked to make sure all the necessary drivers are installed,
but
not sure what is conflicting.

private void Default_Load(object sender, EventArgs e)
{
try
{
this.tPCEXPXRFTSTTableAdapter.Fill(this.tPCEXPXRF. TPCEXPXRFTST);
dataGridView1.CellValidating += new
DataGridViewCellValidatingEventHandler
(dataGridView1_CellValidating);
this.dataGridView1.DataError += new
DataGridViewDataErrorEventHandler
(dataGridView1_DataError);
}
catch (Exception ex)
{
System.Diagnostics.EventLog log = new
System.Diagnostics.EventLog();
log.Log = "System";
log.Source = "CE Item Lookup Table Editor";
log.WriteEntry(ex.ToString());
}
}

Jun 16 '06 #2
Marina:

Thanks for the response, but I placed the try....catch code in to attempt to
trap the error that is stopping the form from loading.

In other words, the app failed before I added that code, so I don't think it
has to do with the actual try....catch.

Thanks
Andy

"Marina Levit [MVP]" wrote:
It is possible the code in your catch is failing. Might be a security issue,
where the user does not have rights to write to the event log.

Not sure why they would just shut down the app, though

"Andy" <An**@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com...
I created a Windows application that is having an odd issue. The
application
starts for a split second, but then closes. I cannot get any error
messages
to display as to what causes the program to close. Listed below is my
Default_Load method. How would I be able to trap the error so I know what
is
causing this form to not load as I do not get any information at this
time.
We have it running on 4 different computers, but the one computer won't
let
it run. We checked to make sure all the necessary drivers are installed,
but
not sure what is conflicting.

private void Default_Load(object sender, EventArgs e)
{
try
{
this.tPCEXPXRFTSTTableAdapter.Fill(this.tPCEXPXRF. TPCEXPXRFTST);
dataGridView1.CellValidating += new
DataGridViewCellValidatingEventHandler
(dataGridView1_CellValidating);
this.dataGridView1.DataError += new
DataGridViewDataErrorEventHandler
(dataGridView1_DataError);
}
catch (Exception ex)
{
System.Diagnostics.EventLog log = new
System.Diagnostics.EventLog();
log.Log = "System";
log.Source = "CE Item Lookup Table Editor";
log.WriteEntry(ex.ToString());
}
}


Jun 16 '06 #3
It may be a larger issue then, of not being able to find a required DLL, or
something that makes it impossible for the application to load at all.

"Andy" <An**@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
Marina:

Thanks for the response, but I placed the try....catch code in to attempt
to
trap the error that is stopping the form from loading.

In other words, the app failed before I added that code, so I don't think
it
has to do with the actual try....catch.

Thanks
Andy

"Marina Levit [MVP]" wrote:
It is possible the code in your catch is failing. Might be a security
issue,
where the user does not have rights to write to the event log.

Not sure why they would just shut down the app, though

"Andy" <An**@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com...
>I created a Windows application that is having an odd issue. The
>application
> starts for a split second, but then closes. I cannot get any error
> messages
> to display as to what causes the program to close. Listed below is my
> Default_Load method. How would I be able to trap the error so I know
> what
> is
> causing this form to not load as I do not get any information at this
> time.
> We have it running on 4 different computers, but the one computer won't
> let
> it run. We checked to make sure all the necessary drivers are
> installed,
> but
> not sure what is conflicting.
>
> private void Default_Load(object sender, EventArgs e)
> {
> try
> {
>
> this.tPCEXPXRFTSTTableAdapter.Fill(this.tPCEXPXRF. TPCEXPXRFTST);
> dataGridView1.CellValidating += new
> DataGridViewCellValidatingEventHandler
> (dataGridView1_CellValidating);
> this.dataGridView1.DataError += new
> DataGridViewDataErrorEventHandler
> (dataGridView1_DataError);
> }
> catch (Exception ex)
> {
> System.Diagnostics.EventLog log = new
> System.Diagnostics.EventLog();
> log.Log = "System";
> log.Source = "CE Item Lookup Table Editor";
> log.WriteEntry(ex.ToString());
> }
> }


Jun 16 '06 #4
Andy wrote:
I created a Windows application that is having an odd issue. The application
starts for a split second, but then closes. I cannot get any error messages


How are you starting your app? Do you have a main form and the startup
object is that form? Or are you starting from main? Can you show the
entry point of the application?

Jun 16 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Marc Gravell | last post: by
7 posts views Thread by h7qvnk7q001 | last post: by
9 posts views Thread by 47computers | last post: by
5 posts views Thread by kellygreer1 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.