To Registry when closing a UserControl

  • Thread starter Thread starter **Developer**
  • Start date Start date
D

**Developer**

I have a UserControl on a form.
The form is closing and I need the usercontrol to write to the Registry.

Where do I do that?

In the Disposed event? I need to do it when controls on the usercontrol are
still active so I can write, for example, the Text value of a Textbox.

In the Overrides Sub Dispose method? if so, before or after the
If disposing Then statement?



I've read Help and got only more confused.



Thanks
 
Just use the closing event of the form

Imports Microsoft.Win32

Dim reg As RegistryKey
reg = Registry.LocalMachine.OpenSubKey("Software\MyKey", True)
reg.SetValue("My Key", "My Value")
If Not (reg Is Nothing) Then reg.Close()

I hope this helps

Crouchie1998
BA (HONS) MCP MCSE
 
Not the form. I wish the UserControl had a closing event.

The question is about the UserControl doing it.

Thankls
 
Back
Top