Hi,

Code below generates this error "Run-time error 424 Object required". What can i do? VB6.

thanks

Private Sub Command3_Click()
    My.Computer.Registry.CurrentUser.CreateSubKey ("TestKey")
End Sub

what is My ?

is that an object ?

Use VB.Net.... not VB 6 :)

Seriously, I like VB6 a thousand times more than .NET, but the fact is, that code is meant for the .NET platform. VB 6 is not quite that object oriented and structured. I suggest however, that to do the same thing in VB6, use WSH. Using the native VB commands to modify the registry (all API Calls) is really ugly. So I guess something like:

Dim wsh
Set wsh = CreateObject("WScript.Shell")
wsh.regwrite "HKCU\testkey\", "hi", "REG_SZ"
Set wsh = Nothing
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.