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

C#

 
Question[Message Deleted] Pin
WCup17-Jun-06 13:22
WCup17-Jun-06 13:22 
AnswerRe: How to avoid :not all code paths return a value Pin
TheBeginner7717-Jun-06 13:37
TheBeginner7717-Jun-06 13:37 
AnswerRe: How to avoid :not all code paths return a value Pin
Christian Graus17-Jun-06 13:38
protectorChristian Graus17-Jun-06 13:38 
AnswerRe: [Message Deleted] Pin
Colin Angus Mackay17-Jun-06 23:02
Colin Angus Mackay17-Jun-06 23:02 
GeneralRe: [Message Deleted] Pin
Malcolm Smart18-Jun-06 0:15
Malcolm Smart18-Jun-06 0:15 
QuestionHow can i add strings to the columns of a dataGridView? [modified]....pls if someone knows.... Pin
TheBeginner7717-Jun-06 11:45
TheBeginner7717-Jun-06 11:45 
QuestionRe: How can i add strings to the columns of a dataGridView? [modified]....pls if someone knows.... Pin
TheBeginner7717-Jun-06 13:52
TheBeginner7717-Jun-06 13:52 
QuestionDelegate / Event Behaviour [modified] Pin
Malcolm Smart17-Jun-06 9:55
Malcolm Smart17-Jun-06 9:55 
Hi
Not sure how to explain this, but here goes. I have a method 'ShowFormForLong' which recieves a long as a parameter. It checks a Dictionary to see if the dictionary contains the long as a key. If it does, the object stored is a form, and the form is 'shown'. If the dictionary doesn't contain the long, a new form is created and added to the dictionary, and shown. Works a treat when the long is entered by the user, they press 'Go' button, and the onButton event calls the ShowFormForLong method.

But...and there always is a but....my app allows sockets to connect, and the socket can recieve a 'long'. I read a long from the socket, and fire an event, which my main form subscribes to. The eventargs contain the 'long' and I call 'ShowFormForLong' passing the long from the eventarg. But this time, the form is shown, but it seems as though the message loop isn't running in the form, as only the background is drawn, no controls are visible, and then the app crashes.

I will get the code on Monday, and post if nobody has any ideas, but is there something I should be doing? Or is it something as simple as I can't create multiple forms...

From memory...
Dictionary< long , MyFormClass>formDictionary;

void ShowFormForLong( long myLong )
{
if (formDictionary.Contains(myLong))
{
   MyFormClass myForm = (MyFormClass)formDictionary[myLong];
   myForm.Show();
}
else
{
   MyFormClass myForm = new MyFormClass();
   formDictionary.Add( myLong , myForm );
   myForm.Show();
}
}


Regards

Rose | [Rose] Angel Rose | [Rose]

*********************************************
The sooner you fall behind, the longer you have to catch up.


-- modified at 16:05 Saturday 17th June, 2006 - typos
QuestionRe: Delegate / Event Behaviour Pin
Jun Du17-Jun-06 10:55
Jun Du17-Jun-06 10:55 
AnswerRe: Delegate / Event Behaviour Pin
Malcolm Smart17-Jun-06 11:19
Malcolm Smart17-Jun-06 11:19 
AnswerRe: Delegate / Event Behaviour Pin
Robert Rohde17-Jun-06 11:00
Robert Rohde17-Jun-06 11:00 
GeneralRe: Delegate / Event Behaviour Pin
Malcolm Smart17-Jun-06 11:16
Malcolm Smart17-Jun-06 11:16 
GeneralRe: Delegate / Event Behaviour Pin
Malcolm Smart17-Jun-06 11:59
Malcolm Smart17-Jun-06 11:59 
GeneralRe: Delegate / Event Behaviour Pin
Robert Rohde17-Jun-06 13:29
Robert Rohde17-Jun-06 13:29 
GeneralRe: Delegate / Event Behaviour Pin
Malcolm Smart17-Jun-06 20:46
Malcolm Smart17-Jun-06 20:46 
AnswerRe: Delegate / Event Behaviour Pin
LongRange.Shooter17-Jun-06 18:15
LongRange.Shooter17-Jun-06 18:15 
GeneralRe: Delegate / Event Behaviour Pin
Malcolm Smart17-Jun-06 20:48
Malcolm Smart17-Jun-06 20:48 
QuestionADO.NET - Inserting a row and getting the ID Pin
AJ12317-Jun-06 9:44
AJ12317-Jun-06 9:44 
AnswerRe: ADO.NET - Inserting a row and getting the ID Pin
LongRange.Shooter17-Jun-06 18:17
LongRange.Shooter17-Jun-06 18:17 
GeneralRe: ADO.NET - Inserting a row and getting the ID Pin
AJ12317-Jun-06 23:08
AJ12317-Jun-06 23:08 
QuestionCreating a Database Connection with C# Pin
v3nn17-Jun-06 9:19
v3nn17-Jun-06 9:19 
AnswerRe: Creating a Database Connection with C# Pin
Guffa17-Jun-06 9:40
Guffa17-Jun-06 9:40 
GeneralRe: Creating a Database Connection with C# [modified] Pin
v3nn17-Jun-06 9:55
v3nn17-Jun-06 9:55 
AnswerRe: Creating a Database Connection with C# Pin
Guffa17-Jun-06 9:59
Guffa17-Jun-06 9:59 
GeneralRe: Creating a Database Connection with C# Pin
v3nn17-Jun-06 11:01
v3nn17-Jun-06 11:01 

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.