Vous êtes sur la page 1sur 4

How to create, edit, and delete a text file using Visual Basic 6? - Tech Su...

http://www.techimo.com/forum/webmastering-programming/150226-how...

home hardware prices news articles forums photos user reviews


Go Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Back Programming

User Name User Name Password


Today's Posts

Remember Me?

How to create, edit, and delete a text file using Visual Basic 6? How to create, edit, and delete a text file using Visual Basic 6?
Register Blogs FAQ Members List Calendar

Advanced Search

Reply

How to create, edit, and delete a text file using Visual Basic 6?
Thread Tools Search this Thread

Currently Active Users: 1403 Old August 24th, 2005, 04:13 AM

Discussions: 223,064, Posts: 2,625,883, Members: 276,946 #1 (permalink) Question How to create, edit, and delete a text file using Visual Basic 6?

Get bargains at Dealighted.com

Acid_ICE24
Member Acid_ICE24's Avatar Join Date: Jul 2005 Location: Cavite, Phil. Posts: 94

Unlimited Online Backup Backup your whole computer for just $7.95/month. No limits, 100% safe.
www.livedrive.com

Ads by Google

PowerBasic vs VisualBasic
www.powerbasic.com
PowerBasic vs VisualBasic Faster. No Run-Times. No Bloat!CGI, Macros, ASM, Reg Expressions hi pips! i'm working on a vb6 project right now and there's a part in it where i need to create a log file. anybody knows how 2 create a text file and then later on, edit or delete it? i made some research and this is what i produced, so far: Sub GenerateLog(vValue As Variant, sField As String) Dim iFileNumber As Integer Static iErrCtr As Integer iErrCtr = iErrCtr + 1 iFileNumber = FreeFile Open App.Path & "\HCFA_LOG.txt" For Append As #iFileNumber If bLogCreated = False Then Write #iF ileNumber, "DATE: " & Format(Date, "MM/dd /yyyy") Write #iFileNumber,

Advantech industrijski PC raunalniki embedded PC computers


www.electra.si/

VHDL Automatically Generate VHDL from Timing Diagrams


TimingTool.com

Centera Data Migration Secure, fast and efficient data transfer.


interlock-tech.com

AdChoices
Ask a Tech Question (free)!
Most Active Discussions
Is It Just Me? (641) Let's be real - who are you voting .. (19) Help! (17) Obama Campaign in Ohio Sues to Bloc.. (31) Just some thoughts (42) Lag...don't know why!! (11) Can I replace an ATI Gfx card with .. (5) Disable JAVA Now - 0-day exploit hi.. (14) F@H **Official** SPAM Thread Episod.. (292) graphic card & mobo (8) Which one is better: GT 620M or Rad.. (5 )

Recent Discussions
order cheap accutane Stanley (0) Help! (17) Just some thoughts (42) Analyze your Facebook data with new W.. (1 ) Help with Windows Media Player (1) new gmail address (2) Can I replace an ATI Gfx card with nV.. (5) 4Gbs of Memory Installed Only 2Gbs Sh.. (3) Install SP1 without internet (12) Lag...don't know why!! (11) Disable JAVA Now - 0-day exploit hits.. (14) Acer & linux (4 ) change router password.. (3)

1 trong 4

9/2/2012 5:36 AM

How to create, edit, and delete a text file using Visual Basic 6? - Tech Su...

http://www.techimo.com/forum/webmastering-programming/150226-how...

"TIME: " & Format(Time, "hh:mm AMPM") Write #iFileNumber, Write #iFileNumber, End If bLogCreated = True Write #iFileNumber, "Error #: " & iErrCtr Write #iFileNumber, "GUID: " & sDocGUID Write #iFileNumber, "Error in field: '" & sField & "'" Write #iFileNumber, "Data: " & vValue Write #iFileNumber, Close #iFileNumber End Sub this works fine but i don't really like how the output looks (notice the quotation marks?). and everytime i call this sub, it doesn't overwrite the old one. any kind of help is welcome.... thanks!

Useful apps (42) Java casting... (6) Totally Awesome Battlefield 3 Case Mo.. (4) F@H **Official** SPAM Thread Episode .. (292 ) Video (1) Computer issue - Please help (4) Need help on what monitor cable I nee.. (3) graphic card & mobo (8) Samsung Harddrive Problem (2) Upgrading graphics in Inspiron 660s (1) Which one is better: GT 620M or Radeo.. (5) save aol mail attachments (3)

Embedded Developer
www.embeddeddeveloper.com Embedded Developer Find Compare Buy Processors & ToolsParametric Database, Ordering Info

Excel VBA Programming


www.vishtumu.com Excel VBA Programming VBA, Macros, User Forms4-day Financial Modeling Training

Real-Time Embedded ODBMS www.ekkySoftware.com


Real-Time Embedded ODBMS Auto, real-time database recoveryprovides 24/7 availability to data

Free Programming Courses


code.he.net Free Programming Courses Get started in minutes!Become a Software Engineer

Ads by Google
Attached Files File Type: HCFA_LOG.txt (1.3 KB, 4790 views) txt

__________________ keep 'em comin... Acid_ICE24 is offline Reply With Quote

2 trong 4

9/2/2012 5:36 AM

How to create, edit, and delete a text file using Visual Basic 6? - Tech Su...

http://www.techimo.com/forum/webmastering-programming/150226-how...

Old August 24th, 2005, 11:26 PM

#2 (permalink)

Acid_ICE24
Member Acid_ICE24's Avatar Join Date: Jul 2005 Location: Cavite, Phil. Posts: 94

anybody?

Ads by Google

TAPI Programming Controls www.topTapi.de


TAPI Programming Controls easy TAPI integration in .NET, VB,VBA, Access, Delphi etc. Reply With Quote
#3 (permalink)

Acid_ICE24 is offline
Old August 26th, 2005, 12:13 PM

Iturea
Banned Iturea's Avatar Join Date: Jan 2004 Location: Earth Posts: 420

Look Here: http://www.garybeene.com /code/visual%20basic.htm

Iturea is offline
Old August 27th, 2005, 02:08 AM

Reply With Quote


#4 (permalink)

Acid_ICE24
Member Acid_ICE24's Avatar Join Date: Jul 2005 Location: Cavite, Phil. Posts: 94

hey, thanks! :-)

Acid_ICE24 is offline
Old August 14th, 2008, 04:27 AM

Reply With Quote


#5 (permalink) Lightbulb

kid_headshot
Junior Member Join Date: Aug 2008 Posts: 1

Ahh, I recently had the same problem as you, but in reverse. I wanted to add data to my file every time, without overwriting what data already existed, as I was making a highscores list. I was using the "OUTPUT" command instead of the "APPEND". If you're making a log file, you want the "OUTPUT" command. Just replace the word "APPEND" with "OUTPUT". However, for the output command, your log file, HCFA_LOG.txt will need to already exist. If this is a problem, then perhaps you could use APPEND but also use the "kill" command to delete your text file upon opening your program each time? EDIT: Oh yeah, and if you don't like the look of that the "write" command produces, use the "print" command in place of it. The print command doesn't store any data about strings or

3 trong 4

9/2/2012 5:36 AM

How to create, edit, and delete a text file using Visual Basic 6? - Tech Su...

http://www.techimo.com/forum/webmastering-programming/150226-how...

variables of any kind, so there are no quotations to separate variables. So, if it's just for the sake of its looks, use print.

Last edited by kid_headshot : August 14th, 2008 at 04:31 AM. Reason: Adding more to my answer

kid_headshot is offline
Reply

Reply With Quote

Similar Threads
Thread Visual Basic Help? HELP!! - Visual Basic Scan Text (Visual Basic .NET question) Visual Basic .Net - DLL file question Visual Basic HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thread Starter redfoxstorm darssus firewolf firewolf George VII Forum Webmastering and Programming Webmastering and Programming Applications and Operating Systems Applications and Operating Systems Webmastering and Programming Replies 1 1 2 15 8 Last Post February 14th, 2005 10:39 AM October 6th, 2004 01:40 PM October 4th, 2003 02:23 PM September 17th, 2003 10:25 PM May 18th, 2002 05:46 PM

Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)

All times are GMT -4. The time now is 07:36 AM. TechIMO Copyright 2012 All Enthusiast, Inc. Contact Us - Tech Support Forums - TechIMO.com - Archive - Privacy Statement - Terms of Use Coupons and Deals and Dealighted - Store Ratings, Avoid Scam Businesses - Top

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

4 trong 4

9/2/2012 5:36 AM

Vous aimerez peut-être aussi