Click here to Skip to main content
16,013,548 members
Home / Discussions / C#
   

C#

 
GeneralRe: releasing PictureBox's Image file handle Pin
ABean18-Jun-04 10:12
ABean18-Jun-04 10:12 
GeneralRe: releasing PictureBox's Image file handle Pin
Dave Kreskowiak18-Jun-04 12:47
mveDave Kreskowiak18-Jun-04 12:47 
GeneralCatch and exit Pin
StephenMcAllister18-Jun-04 9:06
StephenMcAllister18-Jun-04 9:06 
GeneralRe: Catch and exit Pin
Nick Parker18-Jun-04 9:39
protectorNick Parker18-Jun-04 9:39 
GeneralEver growing threads and handles Pin
mitchellguzman18-Jun-04 8:49
professionalmitchellguzman18-Jun-04 8:49 
GeneralRe: Ever growing threads and handles Pin
Daniel Turini18-Jun-04 9:42
Daniel Turini18-Jun-04 9:42 
GeneralHandling disposed event. Pin
Member 114461718-Jun-04 8:20
Member 114461718-Jun-04 8:20 
GeneralRe: Handling disposed event. Pin
Heath Stewart18-Jun-04 18:32
protectorHeath Stewart18-Jun-04 18:32 
Handling the Component.Disposed event would be pointless: the object is disposed - i.e., cleaned-up - before the event is fired.

Instead, call Form.ShowDialog on your add form. When the method returns, see if DialogResult.OK (or whatever is appropriate) was returned. At this point, the Form is still valid, so you can grab values like so:
using (AddForm form = new AddForm())
{
  if (form.ShowDialog() == DialogResult.OK)
  {
    someTextBox.Text = form.SelectedItem; // Made-up property
  }
}
Using the using block like this makes sure that the modal form is disposed even if an exception is thrown. This is necessary for modal forms or you'll notice a decrease in performance and available memory over time.

This is the best way of creating a prompt box. If your form that needs to reflect the changes instantiates and shows the prompt form, then this is the most simple an extensible way of doing it (you can easily reuse your form).

Also, the Form.Closing and Form.Closed events - which are the proper events to use in order to refresh data - are not available in the .NET CF.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Handling disposed event. Pin
Member 114461719-Jun-04 6:01
Member 114461719-Jun-04 6:01 
GeneralCombining referenced assemblies in the EXE Pin
Marc Clifton18-Jun-04 8:03
mvaMarc Clifton18-Jun-04 8:03 
GeneralRe: Combining referenced assemblies in the EXE Pin
leppie18-Jun-04 8:35
leppie18-Jun-04 8:35 
GeneralRe: Combining referenced assemblies in the EXE Pin
Marc Clifton18-Jun-04 9:45
mvaMarc Clifton18-Jun-04 9:45 
GeneralRe: Combining referenced assemblies in the EXE Pin
Nick Parker18-Jun-04 9:28
protectorNick Parker18-Jun-04 9:28 
GeneralRe: Combining referenced assemblies in the EXE Pin
Marc Clifton18-Jun-04 9:44
mvaMarc Clifton18-Jun-04 9:44 
GeneralAVI-Play Pin
PrebKlok18-Jun-04 7:20
PrebKlok18-Jun-04 7:20 
GeneralRe: AVI-Play Pin
Corinna John18-Jun-04 8:11
Corinna John18-Jun-04 8:11 
GeneralRe: AVI-Play Pin
Stefan Troschuetz18-Jun-04 8:58
Stefan Troschuetz18-Jun-04 8:58 
GeneralRe: AVI-Play Pin
sheppe20-Jun-04 7:31
sheppe20-Jun-04 7:31 
GeneralFolderBrowserDialog Pin
Guinness4Strength18-Jun-04 6:57
Guinness4Strength18-Jun-04 6:57 
GeneralRe: FolderBrowserDialog Pin
Heath Stewart18-Jun-04 13:58
protectorHeath Stewart18-Jun-04 13:58 
GeneralRe: FolderBrowserDialog Pin
Guinness4Strength19-Jun-04 10:33
Guinness4Strength19-Jun-04 10:33 
GeneralRe: FolderBrowserDialog Pin
Heath Stewart20-Jun-04 9:49
protectorHeath Stewart20-Jun-04 9:49 
GeneralIcons Resources Not Being Saved Pin
Peter Vertes18-Jun-04 5:29
Peter Vertes18-Jun-04 5:29 
GeneralRe: Icons Resources Not Being Saved Pin
Heath Stewart18-Jun-04 13:50
protectorHeath Stewart18-Jun-04 13:50 
GeneralRe: Icons Resources Not Being Saved Pin
Peter Vertes18-Jun-04 16:13
Peter Vertes18-Jun-04 16:13 

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.