Close

Results 1 to 5 of 5

Thread: Visual basic

  1. #1
    DF VIP Member hitmandk1985's Avatar
    Join Date
    Jul 2002
    Location
    Slough, Berkshire
    Posts
    154
    Thanks
    4
    Thanked:        2
    Karma Level
    271

    Default Visual basic

    does anyone know much about Visual Basic 6?

    if so can u tell me how i make a Class Module that will recieve a text file and allow the user to edit the contents? and use that Class Module to create an ActiveX dll?


    anyone please help

    Regards

    Dean Kennedy

  2. #2
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    289

    Default

    receive a file from where????

  3. #3
    DF VIP Member hitmandk1985's Avatar
    Join Date
    Jul 2002
    Location
    Slough, Berkshire
    Posts
    154
    Thanks
    4
    Thanked:        2
    Karma Level
    271

    Default

    say i had a file on my hard drive

  4. #4
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    289

    Default

    Here is a partial solution, you need to set a reference to MS scripting object. Not tested this as I don't have VB installed on my machine at work.. so you might need to tweak a few things.. you could have also used the VBs native file support such as Open, Get, Print, Write, Close statements.


    public class FileHandler

    dim sFileText as string

    public property get FileContent() as string
    FileContent = sFileText
    End Property

    Public property Let FileContent(byval sContent as string)
    sFileText = sContent
    End Property

    Public Function GetFile(byval sFileName as string) as Boolean

    Dim oFSO as Scripting.FileSystemObject

    GetFile=False
    Set oFSO = New Scripting.FileSystemObject

    If oFSO.FileExists(sFileName) Then
    sFiletext = oFSO.GetFile(sFileName).OpenAsTextStream(ForReading).ReadAll

    GetFile=True
    Else
    'raise error
    End If

    Set oFSO = Nothing

    End Function


    Public Function WriteFile(byval sFileName as string) as Boolean

    Dim oFSO as Scripting.FileSystemObject
    Dim oTS as Scripting.TextStream

    WriteFile=False
    Set oFSO = New Scripting.FileSystemObject

    If oFSO.FileExists(sFileName) Then
    oFSO.DeleteFile(sFileName)
    End If

    Set oTS = oFSO.GetFile(sFileName).OpenAsTextStream(ForWriting)
    oTS.Write sFileText
    oTS.Close

    WriteFile=True

    Set oTS= Nothing
    Set oFSO = Nothing

    End Function

    End Class

  5. #5
    DF VIP Member hitmandk1985's Avatar
    Join Date
    Jul 2002
    Location
    Slough, Berkshire
    Posts
    154
    Thanks
    4
    Thanked:        2
    Karma Level
    271

    Default

    ok thanks ill try that

Similar Threads

  1. Visual Basic 6
    By Digi Program in forum Website Coding & Graphics
    Replies: 2
    Last Post: 15th October 2002, 08:11 PM
  2. Batman vs Superman - basic plot info
    By webslinger2k in forum Movie Talk
    Replies: 2
    Last Post: 4th October 2002, 10:04 PM
  3. visual basic 6 enterprise
    By spade2001 in forum Programming
    Replies: 21
    Last Post: 14th September 2002, 10:51 AM
  4. Basic P4 Setup Suggestions
    By wizer in forum PC Hardware
    Replies: 0
    Last Post: 9th September 2002, 12:00 PM
  5. Visual basic Any one!
    By magic1 in forum The Dog and Duck
    Replies: 2
    Last Post: 8th September 2002, 02:05 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •