How to write at line 2 ,3 or any respectively in order of text file

How to write at line 2 ,3 or any of text file from vb 6.0 ,p

Page 1 of 1

3 Replies - 3045 Views - Last Post: 15 July 2008 - 09:47 AM Rate Topic: -----

#1 karanmymatrix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-July 08

How to write at line 2 ,3 or any respectively in order of text file

Posted 14 July 2008 - 10:40 PM

Hey i have project ,which need log for which i need to write at line 2 ,3 or any in textfile from vb 6.0 form.Please help as soon as possible.
Regards
karan

This post has been edited by PsychoCoder: 15 July 2008 - 05:27 PM

Is This A Good Question/Topic? 0
  • +

Replies To: How to write at line 2 ,3 or any respectively in order of text file

#2 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: How to write at line 2 ,3 or any respectively in order of text file

Posted 14 July 2008 - 10:47 PM

Here's a link that explains file handling:

http://www.dreaminco...wtopic29575.htm


You can create random numbers in this way:
Dim intNumber As Integer

'Only do this once
Randomize

'This will create a random number in the range of 1 to 5
intNumber = Int(Rnd * 5) + 1



If you look at the tutorial at the top and also use the randomizing code I provided, you can probably figure this out. Try it on your own and if you still can't do it, post again but this time with the code you have that's not working.

This post has been edited by Zhalix: 14 July 2008 - 11:05 PM

Was This Post Helpful? 0
  • +
  • -

#3 karanmymatrix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-July 08

Re: How to write at line 2 ,3 or any respectively in order of text file

Posted 14 July 2008 - 11:35 PM

View PostZhalix, on 14 Jul, 2008 - 10:47 PM, said:

Here's a link that explains file handling:

http://www.dreaminco...wtopic29575.htm


You can create random numbers in this way:
Dim intNumber As Integer

'Only do this once
Randomize

'This will create a random number in the range of 1 to 5
intNumber = Int(Rnd * 5) + 1



If you look at the tutorial at the top and also use the randomizing code I provided, you can probably figure this out. Try it on your own and if you still can't do it, post again but this time with the code you have that's not working.




I have attach code.txt file,it contain product pages generation code , i have stemp string var which have to append each time in log file called generationlog.txt which contain line like "Supplier's Product Page Last ID Generated is 6997 7/15/2008 11:17:04 " .

I have to write this line at line 1 of text file ,same way for directory page i have write line "Directory Page Last ID Generated is 6997 7/15/2008 11:17:04 AM" at line 2 of text file.

Same way for different category pages i have write at respective line.
Additionaly it should write current ID which is in above mentioned line only
Not for all ID ok.
Reply as soon as possible.

Attached File(s)

  • Attached File  code.txt (68.54K)
    Number of downloads: 159

Was This Post Helpful? 0
  • +
  • -

#4 tody4me  Icon User is offline

  • Banned
  • member icon

Reputation: 12
  • View blog
  • Posts: 1,398
  • Joined: 12-April 06

Re: How to write at line 2 ,3 or any respectively in order of text file

Posted 15 July 2008 - 09:47 AM

If the file is a fixed length record type file, look at random access for file handling. This gives you a way of seeking within a file for VB6. Otherwise, you will need to read the entire file, split it, and do the searches within code. When the program exits, write the changes back to the file, overwriting the one that you had previously.

This post has been edited by tody4me: 15 July 2008 - 09:47 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1