954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Run-time error 424 Object required

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
veledrom
Master Poster
758 posts since Apr 2008
Reputation Points: 42
Solved Threads: 0
 

what is My ?

is that an object ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You