Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redundant Text File

Status
Not open for further replies.

UnknownUser

Programmer
Joined
Sep 28, 2001
Messages
9
Location
US
Im just starting out in Visual Basic and moving on up to C++ n a few years.. i am trying to make a program that can make multiple names in a single text file such as 100Hello all the way to 1000000000Hello without having to type in all of that (it would take days)... i would need it to ask me for the name i wish to creat and what number from 1 i want to go up to... i already have the interface and most of the code but i dont know how to calculate it all into a single text file with the name that i entered and the number of names..could anyone help..?

-thanks in advance
 
Hi,

Use a proc and send the parameters after you've got them from the user.

e.g.


Private Sub WriteFile(inInitial as integer, _
inNoOfLoops as integer, _
inName as string)

open "C:\X.TXT" for output as #1

for iLoop=inInitial to inInitial+inNoOfLoops
print #1,iLoop & inName
next iloop

close #1

end sub

now this is from thinking, I haven't tried it(this forum has great people who will correct me where I lied)

then run it WriteFile(1,10,"phathi") [/color blue] or whatever.

Ciao
Phathi. >(::O>
 
Hi,

Use a proc and send the parameters after you've got them from the user.

e.g.


Private Sub WriteFile(inInitial as integer, _
inNoOfLoops as integer, _
inName as string)

open "C:\X.TXT" for output as #1

for iLoop=inInitial to inInitial+inNoOfLoops
print #1,iLoop & inName
next iloop

close #1

end sub

now this is from thinking, I haven't tried it(this forum has great people who will correct me where I lied)

then run it WriteFile(1,10,"phathi") or whatever.

Ciao
Phathi. >(::O>
 
oh yeah, i did do the same thing in Unix but that was a year ago and i forgot..we created one text file that said Dummy File about 1000 times, i want to do the same with VB but instead of having it just say Hello a thousand times, i would like it to add one every time (1000Hello, 1001Hello, 1002Hello, etc.) and i want to be able to control how many times i want it to be in the file and which names i want..does that make any sense at all? <font color=red>
Du Kannst Mich Heute Töten, Aber Morgen Wird Ich Dich Besiegen
 
hey thanks alot phathi..ill try that but if anyone else has anything different id like to hear 'em all <font color=red>
Du Kannst Mich Heute Töten, Aber Morgen Wird Ich Dich Besiegen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top