Hi and thanks for your reply
I have now the following code:
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
Dim y As OpenNETCF.Win32.RegistryKey
y = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software",
True)
y.DeleteSubKey("Test")
y.Flush()
y.Close()
MsgBox("Done")
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem2.Click
Dim x As OpenNETCF.Win32.RegistryKey
x = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software",
True)
x.CreateSubKey("Test")
x.Flush()
x.Close()
MsgBox("Done")
End Sub
The interesting thing is: If I use MenuItem2_Click to create the subkey, and
then MenuItem1_Click to delete it, I get the error message. But if I close
my application after creating the SubKey, and then restart it and directly
use MenuItem1_Click, it is deleting the Subkey without any problems...
Devices ar HTC Artemis and HTC Universal, both with WM 5.0
<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag
news:%23uEY0yZnHHA.3888@TK2MSFTNGP03.phx.gbl...
[quoted text, click to view] >A few things:
>
> 1. You might log this as a bug in our issue database
> (bugzilla.opennetcf.com) - probably far greater chance of support if it's
> there.
>
> 2. If you open the key with more that read access does the behavior
> change?
>
> 3. If you flush the key before delete does the behavior change?
>
> 4. What kind of device is this? Does it have a hive-based registry?
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Managed Code in an Embedded World
>
www.OpenNETCF.com >
>
>
> "James Caan" <james@caan.com> wrote in message
> news:711B84DE-7120-4C90-99CC-D90FB133C08C@microsoft.com...
>> Hello
>>
>> I have problem deleting a subkey which I've create some seconds before:
>>
>> Dim x As OpenNETCF.Win32.RegistryKey
>> x = OpenNETCF.Win32.Registry.LocalMachine.OpenSubKey("Software")
>> x.CreateSubKey("Test")
>> System.Threading.Thread.Sleep(10000)
>> x.DeleteSubKey("Test")
>>
>> This is throwing an error "The specified subkey is not a valid reference
>> to a registry key"
>>
>> The interesting thing is, if I wait several minutes, I can delete the
>> subkey...
>>
>> Why?
>>
>> Thanks
>>
>> James
>
>