Click here to Skip to main content
15,902,845 members
Home / Discussions / C#
   

C#

 
GeneralRe: WMI in C#? Pin
ekynox9-Jan-08 9:56
ekynox9-Jan-08 9:56 
GeneralWhy i am getting MessageBox twice Pin
netJP12L8-Jan-08 9:30
netJP12L8-Jan-08 9:30 
GeneralRe: Why i am getting MessageBox twice Pin
Christian Graus8-Jan-08 9:51
protectorChristian Graus8-Jan-08 9:51 
GeneralRe: Why i am getting MessageBox twice Pin
netJP12L8-Jan-08 10:52
netJP12L8-Jan-08 10:52 
GeneralRe: Why i am getting MessageBox twice Pin
Skippums8-Jan-08 11:18
Skippums8-Jan-08 11:18 
GeneralRe: Why i am getting MessageBox twice Pin
netJP12L8-Jan-08 16:19
netJP12L8-Jan-08 16:19 
GeneralRe: Why i am getting MessageBox twice Pin
PIEBALDconsult8-Jan-08 9:52
mvePIEBALDconsult8-Jan-08 9:52 
GeneralRe: Why i am getting MessageBox twice Pin
visualhint11-Jan-08 4:07
visualhint11-Jan-08 4:07 
Hi,

To investigate your issue, I tried your TypeConverter with my product, Smart PropertyGrid.Net. I also got the form twice and this is for this reason: the grid reacts to validation with the Enter key and also to the loss of focus. When Enter is pressed, your ConvertFrom method is called and the dialog box is displayed. Because the grid does not expect any UI to be shown at that moment, it also reacts to the loss of focus and tries to validate again the new value. Therefore, the ConvertFrom is called again and the form is displayed a second time. It won't happen indefinitely since at this time, the focus has been definitely lost.

I guess that the MS PropertyGrid acts in the same way. By showing a message box, you are going against the way it's supposed to work. No UI should be displayed by a TypeConverter whose goal is just to convert. If it fails to convert a value, it's supposed to throw an exception and the grid will show it. Smart PropertyGrid has of course more flexible mechanisms to validate and show errors.

Anyway, in SPG, I was able to stop this problem by defining a static bool isInsideConvertFrom. This way I was able to stop reentrant calls. Even if I think you should not show a UI from your converter, you can try this technique with the MS grid. Maybe it will work. However, I think your grid won't gain the focus back when the message box is closed. But this is to be tested.

Best regards,

Nicolas Cadilhac @ VisualHint
Smart PropertyGrid.Net
Microsoft PropertyGrid Resource List
Free PropertyGrid for MFC
Smart FieldPackEditor.Net / DateTimePicker
General[C#.net] Connection on data base sqlserver Pin
abbd8-Jan-08 8:32
abbd8-Jan-08 8:32 
GeneralRe: [C#.net] Connection on data base sqlserver Pin
J4amieC8-Jan-08 8:58
J4amieC8-Jan-08 8:58 
GeneralRe: [C#.net] Connection on data base sqlserver Pin
Colin Angus Mackay8-Jan-08 9:06
Colin Angus Mackay8-Jan-08 9:06 
GeneralRe: [C#.net] Connection on data base sqlserver Pin
Ennis Ray Lynch, Jr.8-Jan-08 9:29
Ennis Ray Lynch, Jr.8-Jan-08 9:29 
Question.axpx+javascript ? Pin
simworld8-Jan-08 8:24
simworld8-Jan-08 8:24 
AnswerRe: .axpx+javascript ? Pin
Christian Graus8-Jan-08 9:13
protectorChristian Graus8-Jan-08 9:13 
AnswerRe: .axpx+javascript ? Pin
Ennis Ray Lynch, Jr.8-Jan-08 9:32
Ennis Ray Lynch, Jr.8-Jan-08 9:32 
GeneralCustom Xml Serialization Pin
Skippums8-Jan-08 8:09
Skippums8-Jan-08 8:09 
GeneralRe: Custom Xml Serialization Pin
Ennis Ray Lynch, Jr.8-Jan-08 8:39
Ennis Ray Lynch, Jr.8-Jan-08 8:39 
QuestionRe: Custom Xml Serialization Pin
Skippums8-Jan-08 10:07
Skippums8-Jan-08 10:07 
GeneralRe: Custom Xml Serialization Pin
Ennis Ray Lynch, Jr.8-Jan-08 10:12
Ennis Ray Lynch, Jr.8-Jan-08 10:12 
QuestionRe: Custom Xml Serialization Pin
Skippums8-Jan-08 10:33
Skippums8-Jan-08 10:33 
GeneralRe: Custom Xml Serialization Pin
Ennis Ray Lynch, Jr.8-Jan-08 10:35
Ennis Ray Lynch, Jr.8-Jan-08 10:35 
GeneralRe: Custom Xml Serialization Pin
Skippums8-Jan-08 10:48
Skippums8-Jan-08 10:48 
GeneralInteresting Pin
Ennis Ray Lynch, Jr.8-Jan-08 11:01
Ennis Ray Lynch, Jr.8-Jan-08 11:01 
GeneralRe: Interesting Pin
Skippums9-Jan-08 5:12
Skippums9-Jan-08 5:12 
QuestionCreate Axwebbrowser with new Tabpage (VS2005) Pin
cola19738-Jan-08 8:00
cola19738-Jan-08 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.