Welcome to Dream.In.Code
Become a VB Expert!

Join 150,138 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,259 people online right now. Registration is fast and FREE... Join Now!




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

 
Reply to this topicStart new topic

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

karanmymatrix
14 Jul, 2008 - 09:40 PM
Post #1

New D.I.C Head
*

Joined: 14 Jul, 2008
Posts: 6

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 Jul, 2008 - 04:27 PM
User is offlineProfile CardPM
+Quote Post

Zhalix
RE: How To Write At Line 2 ,3 Or Any Respectively In Order Of Text File
14 Jul, 2008 - 09:47 PM
Post #2

D.I.C Head
**

Joined: 7 May, 2008
Posts: 218



Thanked: 9 times
My Contributions
Here's a link that explains file handling:

http://www.dreamincode.net/forums/showtopic29575.htm


You can create random numbers in this way:
CODE

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 Jul, 2008 - 10:05 PM
User is offlineProfile CardPM
+Quote Post

karanmymatrix
RE: How To Write At Line 2 ,3 Or Any Respectively In Order Of Text File
14 Jul, 2008 - 10:35 PM
Post #3

New D.I.C Head
*

Joined: 14 Jul, 2008
Posts: 6

QUOTE(Zhalix @ 14 Jul, 2008 - 10:47 PM) *

Here's a link that explains file handling:

http://www.dreamincode.net/forums/showtopic29575.htm


You can create random numbers in this way:
CODE

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: 17
User is offlineProfile CardPM
+Quote Post

tody4me
RE: How To Write At Line 2 ,3 Or Any Respectively In Order Of Text File
15 Jul, 2008 - 08:47 AM
Post #4

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,349



Thanked: 5 times
Dream Kudos: 100
My Contributions
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 Jul, 2008 - 08:47 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:02AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month