hi!
im somekind in a lost mode.how can i call a txtfile out so that it can run a machine?
eg if i press this cmdA, it will call out txtfile1 and txtfile1(the command to run the machine is stored in here) will run the machine.
and also how is it possible to store in the data collected(by the machine tats running) to textfile?:?: :?: :?: i tried using

Open "\your_name.txt" For Input As #1
Do While Not EOF(1)
intCount = intCount + 1
Print #1, txtWord.Text
Loop
Close #1
but it gives error..what went wrong??im not sure if im doing it correctly.:eek:
im having my final year proj and i hav to learnt this frm scratch as i never done VB in my life..sooo complicating
thnX!

Recommended Answers

All 3 Replies

Hi,

Modify ur code this way,
Dim FN As Long
FN = FreeFile
Open "C:\your_name.txt" For Input As #FN
Do While Not EOF(FN)
intCount = intCount + 1
Print #FN, txtWord.Text
Loop
Close #FN

Regards
Veena

is this for storing the data or opening the file in VB?

hi!
im somekind in a lost mode.how can i call a txtfile out so that it can run a machine?
eg if i press this cmdA, it will call out txtfile1 and txtfile1(the command to run the machine is stored in here) will run the machine.
and also how is it possible to store in the data collected(by the machine tats running) to textfile?:?: :?: :?: i tried using

Open "\your_name.txt" For Input As #1
Do While Not EOF(1)
intCount = intCount + 1
Print #1, txtWord.Text
Loop
Close #1
but it gives error..what went wrong??im not sure if im doing it correctly.:eek:
im having my final year proj and i hav to learnt this frm scratch as i never done VB in my life..sooo complicating
thnX!

Ok, if you're trying to read data from the file, your code needs to change like this (changes in bold) Open "\your_name.txt" For Input As #1
Do While Not EOF(1)
intCount = intCount + 1
Input #1, txtWord.Text
Loop
Close #1
If you're reading in multiple items from the file, you should set up an array and counter variable as was suggested by another forum member. Also, the txtWord.Text portion should probably be changed to the array variable you set up, and you can then manipulate txtWord.Text using the array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.