Click here to Skip to main content
15,880,796 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best way to read string xml? Pin
jschell22-Mar-13 9:57
jschell22-Mar-13 9:57 
Questionform closing event not going to method Pin
MichCl21-Mar-13 4:30
MichCl21-Mar-13 4:30 
AnswerRe: form closing event not going to method Pin
PIEBALDconsult21-Mar-13 5:01
mvePIEBALDconsult21-Mar-13 5:01 
GeneralRe: form closing event not going to method Pin
MichCl21-Mar-13 5:31
MichCl21-Mar-13 5:31 
GeneralRe: form closing event not going to method Pin
PIEBALDconsult21-Mar-13 8:58
mvePIEBALDconsult21-Mar-13 8:58 
AnswerRe: form closing event not going to method Pin
Eddy Vluggen21-Mar-13 5:59
professionalEddy Vluggen21-Mar-13 5:59 
GeneralRe: form closing event not going to method Pin
MichCl21-Mar-13 8:02
MichCl21-Mar-13 8:02 
AnswerRe: form closing event not going to method Pin
Eddy Vluggen21-Mar-13 9:04
professionalEddy Vluggen21-Mar-13 9:04 
Your modification is correct; but it looks like the eventhandler could use a different signature;
C#
private void updateLogsOnClose(Object sender, FormClosingEventArgs e)
As an alternative solution;
C#
  1  using System;
  2  using System.Windows.Forms;
  3  using System.Collections.Generic;
  4  
  5  namespace test
  6  {
  7      class MyControl: UserControl
  8      {
  9          protected override void OnHandleCreated(EventArgs e)
 10          {
 11              base.OnHandleCreated(e);
 12              FindForm().FormClosing += new FormClosingEventHandler(MyControl_FormClosing);
 13          }
 14          void MyControl_FormClosing(object sender, FormClosingEventArgs e)
 15          {
 16              System.Diagnostics.Debugger.Break();
 17          }
 18      }
 19      class Program
 20      {        
 21          public static void Main(string[] args)
 22          {
 23              using (var f = new Form())
 24              {
 25                  MyControl uc = new MyControl() { Dock = DockStyle.Fill };
 26                  f.Controls.Add(uc);
 27                  f.ShowDialog();
 28              }
 29          }
 30      }
 31  }

The reason I'm not calling the FindForm method in the constructor of the UserControl is because it will not be assigned to a form at that point. (It's created on line 25, and added to the form on the next line)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

AnswerRe: form closing event not going to method Pin
Pete O'Hanlon21-Mar-13 9:07
mvePete O'Hanlon21-Mar-13 9:07 
GeneralRe: form closing event not going to method Pin
MichCl21-Mar-13 9:18
MichCl21-Mar-13 9:18 
QuestionHow to combine drawing Pin
wgy_work20-Mar-13 19:04
wgy_work20-Mar-13 19:04 
AnswerRe: How to combine drawing Pin
Richard MacCutchan20-Mar-13 22:50
mveRichard MacCutchan20-Mar-13 22:50 
GeneralRe: How to combine drawing Pin
wgy_work20-Mar-13 22:56
wgy_work20-Mar-13 22:56 
GeneralRe: How to combine drawing Pin
Richard MacCutchan20-Mar-13 23:25
mveRichard MacCutchan20-Mar-13 23:25 
GeneralRe: How to combine drawing Pin
Wayne Gaylard20-Mar-13 23:29
professionalWayne Gaylard20-Mar-13 23:29 
AnswerRe: How to combine drawing Pin
TheRealRarius21-Mar-13 0:40
TheRealRarius21-Mar-13 0:40 
GeneralRe: How to combine drawing Pin
wgy_work21-Mar-13 14:15
wgy_work21-Mar-13 14:15 
QuestionReturn String from a CheckListBox Control Pin
PDTUM20-Mar-13 6:55
PDTUM20-Mar-13 6:55 
AnswerRe: Return String from a CheckListBox Control Pin
Eddy Vluggen20-Mar-13 7:59
professionalEddy Vluggen20-Mar-13 7:59 
AnswerRe: Return String from a CheckListBox Control Pin
PDTUM20-Mar-13 8:45
PDTUM20-Mar-13 8:45 
GeneralRe: Return String from a CheckListBox Control Pin
Eddy Vluggen20-Mar-13 12:15
professionalEddy Vluggen20-Mar-13 12:15 
QuestionHow declare in wcf a typed class to avoid serialization duplication Pin
anymalo20-Mar-13 1:21
anymalo20-Mar-13 1:21 
AnswerRe: How declare in wcf a typed class to avoid serialization duplication Pin
Eddy Vluggen20-Mar-13 1:33
professionalEddy Vluggen20-Mar-13 1:33 
GeneralRe: How declare in wcf a typed class to avoid serialization duplication Pin
anymalo20-Mar-13 3:06
anymalo20-Mar-13 3:06 
GeneralRe: How declare in wcf a typed class to avoid serialization duplication Pin
Eddy Vluggen20-Mar-13 7:46
professionalEddy Vluggen20-Mar-13 7:46 

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.