Wrox Programmer Forums
|
BOOK: Stephens' Visual Basic Programming 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' Visual Basic Programming 24-Hour Trainer by Rod Stephens; ISBN: 978-0-470-94335-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' Visual Basic Programming 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2011, 12:13 AM
Authorized User
 
Join Date: May 2011
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default Ex 21-3 SimpleEdit modification

The exercise in the book says "... To test the program, open the file Test.rtf in Microsoft Word. Make changes in the SimpleEdit program and try to save them into that file. ...". I don't have Word, so I used WordPad. Your program (and mine) allows me to save it in that file without giving me an error. I then close WordPad and reopen the file in WordPad and the changes were made. I inferred from the excerpted statement that the program would throw an error. Is that what was implied or did I read that statement incorrectly? Would this have worked differently in Word?

Keith Z.
 
Old September 1st, 2011, 10:02 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Keith,

Yes, the result is different in Word. Word has a fancier file manipulation model so when it has a file open for editing it locks the file. If a program tries to open a file locked by Word, it will fail.

WordPad doesn't lock the files it has open so your program will be able to open the file.

As an alternative test, set a breakpoint in the program on the statement that opens the file. Run to that point and then rename or delete the file before continuing. The program should fail to open the file (because it is no longer there) and the error handling code should deal with it.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (September 1st, 2011)
 
Old September 1st, 2011, 08:24 PM
Authorized User
 
Join Date: May 2011
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default

OK, Thanks.

Keith Z.





Similar Threads
Thread Thread Starter Forum Replies Last Post
? p. 21 wrogers814 BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 2 September 9th, 2009 10:01 AM
list_entry(), page 21 logicman112 BOOK: Professional Linux Kernel Architecture ISBN: 978-0-470-34343-2 1 March 19th, 2009 03:56 AM
Modification on records.....one by one. akshay_rangar ASP.NET 2.0 Basics 0 January 26th, 2007 12:57 PM
Over 21 calculator - project PetraMan Javascript How-To 1 March 29th, 2005 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.