how does break affect try .. catch... finally in C# 2003

Posted on 2007-11-19
Last Modified: 2008-02-01
In this scenario, will the break cause the finally to be skipped?

foreach (Xceed.Grid.DataRow dr in this.gcResults.DataRows)
				foreach (Xceed.Grid.DetailGrid dGrid in dr.DetailGrids)
					foreach (Xceed.Grid.DataRow drSub in dGrid.DataRows)
						if (Convert.ToBoolean(drSub.Cells[6].Value) == true)
								//expire the old record
								//insert the new record
							catch (Exception ex)
								MessageBox.Show (this,"Failure To Write Record | " + ex.Message,"Commercial Bag PA Bulk Update",MessageBoxButtons.OK,MessageBoxIcon.Warning);
								if (c.State != ConnectionState.Closed)

Open in new window

Question by:g_johnson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 350 total points
ID: 20315491
break where?

anyhow, break will only terminate the closest loop or switch, so it will only terminate that. it will NOT skip the finally.
LVL 15

Assisted Solution

Solar_Flare earned 150 total points
ID: 20315524
Finally will ALWAYS be executed, even returning a function from inside the try..catch will still execute the finally code

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question