Click here to Skip to main content
15,899,475 members
Home / Discussions / C#
   

C#

 
GeneralRe: Modeless dialog issue Pin
aei_totten19-Apr-10 8:09
aei_totten19-Apr-10 8:09 
GeneralRe: Modeless dialog issue Pin
Richard Blythe19-Apr-10 9:59
Richard Blythe19-Apr-10 9:59 
GeneralRe: Modeless dialog issue Pin
aei_totten19-Apr-10 10:54
aei_totten19-Apr-10 10:54 
GeneralRe: Modeless dialog issue Pin
Richard Blythe19-Apr-10 11:25
Richard Blythe19-Apr-10 11:25 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:09
aei_totten20-Apr-10 3:09 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:50
aei_totten20-Apr-10 3:50 
AnswerRe: Modeless dialog issue Pin
Gregory Gadow19-Apr-10 11:05
Gregory Gadow19-Apr-10 11:05 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 2:11
aei_totten20-Apr-10 2:11 
Gregory.Gadow wrote:
Added: After looking at the code you posted above, I can see the problem. After calling Show(), the method ends. The variable referencing your form goes out of scope and gets recycled: your form is not getting a chance to render before it gets disposed. If it absolutely has to be modeless, you will need to move the scope of your form's variable out.


Now, that makes sense.
However, in the real application, I have more demands of that form (I just wanted to get a simple one working first because I was running into this issue and couldn't pin point it).

Here's some code....
   private Dictionary<string, ChatMessageForm> chatMessages = new Dictionary<string, ChatMessageForm>();<br />
...<br />
     string message, sender;          <br />
           message = "blah";<br />
           sender = "me";<br />
            if (!chatMessages.ContainsKey(sender))<br />
            {<br />
                chatMessages.Add(sender, new ChatMessageForm(sender));<br />
            }<br />
            chatMessages[sender].ShowDialog();}


The Dictionary is declared outside of the process in the scope of the main form. However, i do think the issue is related. This is my first time using Dictionary so maybe I am missing something there...
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 3:33
aei_totten20-Apr-10 3:33 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 5:48
Richard Blythe20-Apr-10 5:48 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 6:11
aei_totten20-Apr-10 6:11 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 7:10
Richard Blythe20-Apr-10 7:10 
GeneralRe: Modeless dialog issue Pin
aei_totten20-Apr-10 7:31
aei_totten20-Apr-10 7:31 
GeneralRe: Modeless dialog issue Pin
Richard Blythe20-Apr-10 8:00
Richard Blythe20-Apr-10 8:00 
QuestionEject a remote computers CD rom Pin
Jacob Dixon19-Apr-10 7:46
Jacob Dixon19-Apr-10 7:46 
AnswerRe: Eject a remote computers CD rom Pin
Dave Kreskowiak19-Apr-10 10:29
mveDave Kreskowiak19-Apr-10 10:29 
GeneralRe: Eject a remote computers CD rom Pin
Jacob Dixon19-Apr-10 12:40
Jacob Dixon19-Apr-10 12:40 
GeneralRe: Eject a remote computers CD rom Pin
Luc Pattyn19-Apr-10 12:59
sitebuilderLuc Pattyn19-Apr-10 12:59 
GeneralRe: Eject a remote computers CD rom Pin
Dave Kreskowiak19-Apr-10 14:01
mveDave Kreskowiak19-Apr-10 14:01 
Questionwhy move using statement into namespace? [modified][Solved] Pin
yu-jian19-Apr-10 6:33
yu-jian19-Apr-10 6:33 
AnswerRe: why move using statement into namespace? [modified] Pin
dan!sh 19-Apr-10 6:56
professional dan!sh 19-Apr-10 6:56 
GeneralRe: why move using statement into namespace? Pin
PIEBALDconsult19-Apr-10 7:19
mvePIEBALDconsult19-Apr-10 7:19 
GeneralRe: why move using statement into namespace? Pin
yu-jian20-Apr-10 6:52
yu-jian20-Apr-10 6:52 
AnswerRe: why move using statement into namespace? Pin
Luc Pattyn19-Apr-10 7:00
sitebuilderLuc Pattyn19-Apr-10 7:00 
GeneralRe: why move using statement into namespace? Pin
dan!sh 19-Apr-10 7:03
professional dan!sh 19-Apr-10 7:03 

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.