Results 1 to 5 of 5

Thread: [2008] Read File Text

  1. #1

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    [2008] Read File Text

    Hello, i have gotten my program to successfully write to a file called test.txt. It has the first set of information on one line and the second set of information on the second line. The read code i have is putting the information together. I need to find a way to split the separate lines and get the information.

    Also i have tried to use the sendkey function to send the information that is saved but it is not working. I have posted my code below and i hope that someone could help me with this situation.

    Code:
    Dim fileReader As String
            fileReader = My.Computer.FileSystem.ReadAllText(App_Path() + "test.txt")
            MsgBox(fileReader)
    
            SendKeys.Send(fileReader)
    Then

    Code:
    SendKeys.Send(fileReader)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] Read File Text

    First of all, in your other thread I pointed out that your App_Path method is pointless. Use Application.StartupPath or My.Application.Info.DirectoryPath.

    As for reading the file contents, you could use String.Split to split the result of ReadAllText into an array but there's no need. The File.ReadAllLines method is what you want.

    Also, you should make sure you've read the documentation for the SendKeys.Send method so you know exactly how it works.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Re: [2008] Read File Text

    Ok thank you i will read the documentation tomorrow. I know the app_path thing is pointless but i am so used to vb6 i cant get past using it.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] Read File Text

    So you're going to declare a method named App_Path in every project you create just so that you can use the same name as you did in VB6? If you don't declare such a method then you won't be able to call it so you'll soon get used to its not being there. Trying to make VB.NET feel as much like VB6 as possible is a sure way to make it harder to learn VB.NET. To each their own though.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Re: [2008] Read File Text

    Yea i guess ill start using Application.StartupPath then.

Posting Permissions

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



Click Here to Expand Forum to Full Width