473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MessageBox oddity

Relatively new to C# and I have an odd situation. When I show a messagebox
when catching an exception, the message shows briefly then disappears.

private void PopulateBrands()
{
SqlConnection strSQLServer = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand("sel_BrandsEST", strSQLServer);
cmd.CommandType = CommandType.StoredProcedure;
if (ds.Tables.Contains("dtBrands"))
{
ds.Tables["dtBrands"].Clear();
}
try
{
strSQLServer.Open();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds, "dtBrands");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
dtBrands = ds.Tables["dtBrands"];

}
Jul 19 '06 #1
3 1205

"Earl" <br******@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Relatively new to C# and I have an odd situation. When I show a messagebox
when catching an exception, the message shows briefly then disappears.
In the debugger or in the release version? All sorts of strange things can
get intercepted by the debugger.
Jul 20 '06 #2
In the IDE. Strange, the equivalent syntax in VB.Net does not do the same
thing.

"Michael A. Covington" <lo**@ai.uga.edu.for.addresswrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
"Earl" <br******@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Relatively new to C# and I have an odd situation. When I show a
messagebox when catching an exception, the message shows briefly then
disappears.

In the debugger or in the release version? All sorts of strange things
can get intercepted by the debugger.


Jul 20 '06 #3
Is this happening in a non-UI thread?
Ie. What is calling this method?

Jul 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
2
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
4
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing...
0
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; ...
2
by: Andrew Ducker | last post by:
When returning from a multithread callback, I've wrapped my code up with: if (MainForm.InvokeRequired) MainForm.Invoke(CallStart,new object{BusinessCaller}); else CallStart(BusinessCaller); ...
5
by: jmdocherty | last post by:
All, I've been trying to set up a CSS layout and all seems well in Firefox but in Safari it just seems to be plain weird! I hope someone can help tell me whether this is a problem with my code...
43
by: michael.f.ellis | last post by:
The following script puzzles me. It creates two nested lists that compare identically. After identical element assignments, the lists are different. In one case, a single element is replaced. In...
6
by: Rex the Strange | last post by:
Hello all, Traditionally I'm a Delphi and VB6 programmer and have recently started working with VB.NET (which, I might add, I love, but that's beside the point). Anyway, I was trying to make a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.