I have a question about something that I don't understand which doesn't seem to affect anything. I have an application that uses a grid to find and select a detail record. I have two cells that contain phone numbers so I have a private sub that handles grid cell formating. All works.
Here is what I don't understand; When the user double clicks a row the detail form opens as a dialog window. When I debug my code, I find that after the form is loaded, code excution returns to, and runs, the grid cell formating procedure back in the grid form window. Is this "normal" or is there a way to prevent this?

Thanks
Charles

>Is this "normal" or is there a way to prevent this?

Text From MSDN - The CellFormatting event occurs every time each cell is painted, so you should avoid lengthy processing when handling this event. This event also occurs when the cell FormattedValue is retrieved or its GetFormattedValue method is called.

Take a time to read these articles :

1. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting%28VS.85%29.aspx
2. http://msdn.microsoft.com/en-us/library/f9x2790s.aspx
3. http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx

Thanks for the Reply. Perhaps I did not make my question clear enough. The issue is NOT WITH Formating a Cell in a Grid. I got that part. My question is this: Why would code execution RETURN TO cellfomatting AFTER OPENING a DIALOG BOX WHILE THE DIALOG BOX IS STILL OPEN. I thought after a "show.dialog()" code execution is halted in the calling form and yet I see that cellformatting is triggered while the dialog box is open.

>Is this "normal" or is there a way to prevent this?

Text From MSDN - The CellFormatting event occurs every time each cell is painted, so you should avoid lengthy processing when handling this event. This event also occurs when the cell FormattedValue is retrieved or its GetFormattedValue method is called.

Take a time to read these articles :

1. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting%28VS.85%29.aspx
2. http://msdn.microsoft.com/en-us/library/f9x2790s.aspx
3. http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.