|
-
Feb 13th, 2008, 01:10 AM
#1
Thread Starter
Member
[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)
-
Feb 13th, 2008, 01:16 AM
#2
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.
-
Feb 13th, 2008, 01:42 AM
#3
Thread Starter
Member
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.
-
Feb 13th, 2008, 01:53 AM
#4
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.
-
Feb 13th, 2008, 06:58 AM
#5
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|