VB2005: Getting specific data from file(s)

Discussion in 'Visual Basic ( VB )' started by Amerigo, Jan 24, 2009.

  1. Amerigo

    Amerigo New Member

    Joined:
    Jan 17, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Walmart Associate
    Location:
    USA
    Home Page:
    http://amerigoware.myfreeforum.org/
    Could someone, please, show me a sample code to:
    Open a file
    load a specific data entry from the file
    Use the data in an If then statement
    Close file

    Code:
    Dim strinput As String = ""
    Dim split() As String
    'other appropriate dims
    FileOpen(1, Application.StartupPath & "\preferences.txt", OpenMode.Input)
    'find & load "Level = "
    
    Input(1, strinput)
    split = strinput.Split("=")
    
    If (string) = "Level = 3" then
    ~~~bla bla bla
    End if
    FileClose(1)
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice