Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Opening And Reading Text Files

iori85ziori85z Posts: 1Member
Hi, I am new to Visual Basic and currently, I need to do a small software, which has a Open button and a textbox. So when I press the open button, it is suppose to open the open dialog box for users to select the text(log) files in C: to open. Then when the user open it, the contents will be viewed on the textbox. Does anyone has a code or solution for this, any help will be greatly appreciated. Thanks.

Comments

  • PavlinIIPavlinII Posts: 404Member
    : Hi, I am new to Visual Basic and currently, I need to do a small software, which has a Open button and a textbox. So when I press the open button, it is suppose to open the open dialog box for users to select the text(log) files in C: to open. Then when the user open it, the contents will be viewed on the textbox. Does anyone has a code or solution for this, any help will be greatly appreciated. Thanks.
    :
    Hi
    [code]Dim iFile as integer, strLog as string, FileName as string
    iFile = FreeFile()
    FileName = "C:logFile.log"
    Open FileName For Binary Access Read As #iFile
    strLog = Space(FileLen(FileName))
    Get #iFile, , strLog
    Close #iFile
    Text1.Text=strLog[/code]
    There exists several ways to get text from file... this is one of them


    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


  • ghdavisghdavis Posts: 1Member
    : : Hi, I am new to Visual Basic and currently, I need to do a small software, which has a Open button and a textbox. So when I press the open button, it is suppose to open the open dialog box for users to select the text(log) files in C: to open. Then when the user open it, the contents will be viewed on the textbox. Does anyone has a code or solution for this, any help will be greatly appreciated. Thanks.
    : :
    : Hi
    : [code]Dim iFile as integer, strLog as string, FileName as string
    : iFile = FreeFile()
    : FileName = "C:logFile.log"
    : Open FileName For Binary Access Read As #iFile
    : strLog = Space(FileLen(FileName))
    : Get #iFile, , strLog
    : Close #iFile
    : Text1.Text=strLog[/code]
    : There exists several ways to get text from file... this is one of them
    :
    :
    : [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]
    :
    : [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]
    :
    :
    :

Sign In or Register to comment.