8 Replies - 6991 Views - Last Post: 11 July 2012 - 09:22 AM Rate Topic: -----

#1 Chaduscus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-July 12

Run time error "424": Object required

Posted 09 July 2012 - 06:05 PM

Hello,. i'm new to this forum.
About 3 mins old
So please forgive me if i do anything wrong
Basically i'm making a program for shortcuts. And the code i'm using is


Private Sub Command2_Click()
If My.Computer.FileSystem.FileExists("Form2.text1.text") Then
    MsgBox ("File found.")
Else
    MsgBox ("File not found.")
End If
End Sub


the text of text1 is the directory of the file,
And i once got this code working. but i tried it again and it failed.
If it had anything to do with my OS it's windows 7 ultimate 64-bit.

If you need any more information please just ask.
I'll gladly replay. :)

Is This A Good Question/Topic? 0
  • +

Replies To: Run time error "424": Object required

#2 Chaduscus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-July 12

Re: Run time error "424": Object required

Posted 09 July 2012 - 06:24 PM

First of all. sorry for double-posting. i didn't see a edit button.

and if you want the sources i checked there was many but the only one i remember is http://msdn.microsof...4(v=vs.80).aspx
. Thanks!

~~ Chaduscus
Was This Post Helpful? 0
  • +
  • -

#3 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Run time error "424": Object required

Posted 09 July 2012 - 06:28 PM

Remove the quotes around Form2.text1.Text. You only use quotes when you want to pass in the literal text that is inside those quotes. In this instance, you want to the pass in the text that is held in the Text property of the text1 object.
Was This Post Helpful? 0
  • +
  • -

#4 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,778
  • Joined: 26-March 09

Re: Run time error "424": Object required

Posted 10 July 2012 - 12:25 AM

As Kilorn has said, you're currently looking for a file called "Form2.text1.Text", but I don' think that's your problem.

Are you using VB6 or VB.Net? If you're using VB6, the code you've tried to execute is more like .Net code.

Also, if it's VB6, have a look at the FileSystemObject (You'll need to add a reference to it) as it will give you the same sort of functionality.
Was This Post Helpful? 0
  • +
  • -

#5 Chaduscus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-July 12

Re: Run time error "424": Object required

Posted 10 July 2012 - 06:36 AM

I tried removing the quotes. but it didn't seem to work.

Can you please explain the syntax for me? i couldn't understand it. Give an example if you could.
I'm still new by the way so there are alot of things that i don't know yet.
Was This Post Helpful? 0
  • +
  • -

#6 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Run time error "424": Object required

Posted 10 July 2012 - 11:30 AM

maj3091 brings up a good point. We need to know exactly which language you are trying to use. There are huge differences between VB6 and VB.NET. You've posted this in the VB6 section of the site, but you're trying to call the My.Computer.FileSystem.FileExists method, which is only usable in .NET code.
Was This Post Helpful? 0
  • +
  • -

#7 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Run time error "424": Object required

Posted 10 July 2012 - 11:32 AM

You'll need to answer that question before we can help you further.
Was This Post Helpful? 0
  • +
  • -

#8 Chaduscus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-July 12

Re: Run time error "424": Object required

Posted 10 July 2012 - 04:12 PM

I'm using VB6.
Was This Post Helpful? 0
  • +
  • -

#9 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Run time error "424": Object required

Posted 11 July 2012 - 09:22 AM

Well, the My.Computer.FileSystem object doesn't exist in VB6. That's a VB.Net thing. :) So, instead, look up the FileSystemObject object and use it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1