Click here to Skip to main content
15,905,144 members
Home / Discussions / C#
   

C#

 
Questiondrag and drop in datagridview??????? Pin
San@Coding9-Sep-07 0:14
San@Coding9-Sep-07 0:14 
Questionhow can send a Unicode message with "at command" and gsm ? Pin
B.A8-Sep-07 21:42
B.A8-Sep-07 21:42 
AnswerRe: how can send a Unicode message with "at command" and gsm ? Pin
Giorgi Dalakishvili8-Sep-07 23:34
mentorGiorgi Dalakishvili8-Sep-07 23:34 
GeneralRe: how can send a Unicode message with "at command" and gsm ? Pin
B.A9-Sep-07 19:18
B.A9-Sep-07 19:18 
GeneralRe: how can send a Unicode message with "at command" and gsm ? Pin
Giorgi Dalakishvili9-Sep-07 20:36
mentorGiorgi Dalakishvili9-Sep-07 20:36 
QuestionKey Presses Pin
ahojed8-Sep-07 21:00
ahojed8-Sep-07 21:00 
AnswerRe: Key Presses Pin
Ermak868-Sep-07 22:50
Ermak868-Sep-07 22:50 
AnswerRe: Key Presses Pin
Giorgi Dalakishvili8-Sep-07 23:23
mentorGiorgi Dalakishvili8-Sep-07 23:23 
GeneralRe: Key Presses Pin
ahojed9-Sep-07 4:14
ahojed9-Sep-07 4:14 
GeneralRe: Key Presses Pin
Giorgi Dalakishvili9-Sep-07 4:40
mentorGiorgi Dalakishvili9-Sep-07 4:40 
Questionsocket programing Pin
ali_reza_zareian8-Sep-07 19:19
ali_reza_zareian8-Sep-07 19:19 
AnswerRe: socket programing Pin
Ermak868-Sep-07 22:55
Ermak868-Sep-07 22:55 
Questionsocket programing Pin
ali_reza_zareian8-Sep-07 19:19
ali_reza_zareian8-Sep-07 19:19 
AnswerRe: socket programing Pin
Vasudevan Deepak Kumar8-Sep-07 23:56
Vasudevan Deepak Kumar8-Sep-07 23:56 
QuestionUse textfile as source for a combo boxes items? Pin
clashie8-Sep-07 16:15
clashie8-Sep-07 16:15 
AnswerRe: Use textfile as source for a combo boxes items? Pin
Christian Graus8-Sep-07 16:21
protectorChristian Graus8-Sep-07 16:21 
GeneralRe: Use textfile as source for a combo boxes items? Pin
clashie8-Sep-07 17:42
clashie8-Sep-07 17:42 
QuestionMarshalling Pin
aruna_koride8-Sep-07 13:46
aruna_koride8-Sep-07 13:46 
QuestionPropertyGrid Binding in WPF Pin
aruna_koride8-Sep-07 13:38
aruna_koride8-Sep-07 13:38 
QuestionUsing Low Level keyboard hook problem [modified] Pin
kamalesh828-Sep-07 12:03
kamalesh828-Sep-07 12:03 
QuestionSingle instance forms in an MDI app Pin
martin_hughes8-Sep-07 9:20
martin_hughes8-Sep-07 9:20 
AnswerRe: Single instance forms in an MDI app [modified] Pin
Ed.Poore8-Sep-07 12:25
Ed.Poore8-Sep-07 12:25 
GeneralRe: Single instance forms in an MDI app [modified] Pin
martin_hughes8-Sep-07 13:38
martin_hughes8-Sep-07 13:38 
Problem with this is that once the login form has been opened and closed once, it gets disposed, so neither the Show() or Activate() methods will work.

Easily fixed by hacking your example and adding an additional else if:

if (!this.SingleInstanceForms.ContainsKey(typeof(T)))
{
    T newForm = new T();
    this.SingleInstanceForms.Add(typeof(T),newForm);
    newForm.MdiParent = this;
}
else if (this.SingleInstanceForms[typeof(T)].IsDisposed)
{
    T newForm = new T();
    this.SingleInstanceForms[typeof(T)] = newForm;
    newForm.MdiParent = this;
}


But doing so looks a bit errrmm inellegant - although I'm sure that it could be refactored out to be made nicer (but it's late and I've had a couple of beers). Or microsoft could implement an UnDispose() method Smile | :)

Anyway, cheers - it was interesting having a look at generics, which I haven't really dipped into yet.

A quick question:

protected virtual void ActivateChildForm<T>() where T : Form, new()


I guess that the where T : Form limits what can be passed in as <T>, but what's the new() about?



Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!

-Excerpt from a support call taken by me, 08/31/2007

GeneralRe: Single instance forms in an MDI app Pin
Ed.Poore8-Sep-07 13:51
Ed.Poore8-Sep-07 13:51 
GeneralRe: Single instance forms in an MDI app Pin
martin_hughes8-Sep-07 14:18
martin_hughes8-Sep-07 14:18 

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.