Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 25th, 2005, 08:14 AM
Registered User
 
Join Date: Mar 2005
Location: Pune, Maharashtra, India.
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Anup Gavate Send a message via Yahoo to Anup Gavate
Default Method or Data member not found

Hi all,

I am in big trouble and i need help to sort out file read write problem.

Following code is not working and displaying error "Method or Data member not found". Please let me know if i need to include any reference file other than scrrun.dll to execute following code.

    Dim fsoObject As New Scripting.FileSystemObject
    Dim txtFileObject As Scripting.File

    If fsoObject.FileExists("c:\conn.ini") Then
        MsgBox "Exists!!!"

        Set txtFileObject = fsoObject.OpenTextFile("c:\conn.ini", ForReading)

        Do Until txtFileObject.AtEndOfStream
            txtFileObject.ReadLine ("[StartUp]")
            txtFileObject.Close
        Loop
    Else
        MsgBox "Not Exists!!!"

        Set txtFileObject = fsoObject.CreateTextFile("c:\conn.ini", ForWriting)

        txtFileObject.WriteLine ("[StartUp]")
        txtFileObject.WriteLine ("UID=sa")
        txtFileObject.WriteLine ("Password=manish")
        txtFileObject.WriteLine ("Server=Anup")
        txtFileObject.WriteLine ("DBName=thanksdarling")
        txtFileObject.Close

        MsgBox "File created and data written to the file!!!"
    End If

    Set txtFileObject = Nothing
    Set fsoObject = Nothing


  #2 (permalink)  
Old March 25th, 2005, 03:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in the line

 Dim txtFileObject As Scripting.File

mybe you meant

 Dim txtFileObject As Scripting.TextStream

The line

  txtFileObject.ReadLine ("[StartUp]")

is wrong, because txtFileObject foes not parameters, it just returns a string

Just for curiosity, did you download that code?
Marco
  #3 (permalink)  
Old March 25th, 2005, 04:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Another suggestion: run with a full compile (Ctrl+F5), in this way the compiler will find the compiler errors before you run, and it will show the first of them in the IDE, highlighting the wrong line.
Marco


Similar Threads
Thread Thread Starter Forum Replies Last Post
complile error : method or data member not found! Tasha Access VBA 6 May 1st, 2007 03:49 PM
Method or Data Member not Found Related to Crystal ishqvj Beginning VB 6 0 November 29th, 2006 03:49 AM
Method or data member not found Subuana Beginning VB 6 1 March 6th, 2006 03:32 PM
LoadFrom Invoke Member... Method not found DolphinBay VB.NET 2002/2003 Basics 1 April 29th, 2004 10:01 AM
LoadFrom Invoke Member... Method not found DolphinBay ASP.NET 1.0 and 1.1 Basics 0 April 29th, 2004 09:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.