MessageBox oddity

E

Earl

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"];

}
 
M

Michael A. Covington

Earl said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top