Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 1st, 2011, 12:13 AM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
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.
Reply With Quote
  #2 (permalink)  
Old September 1st, 2011, 10:02 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
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!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (September 1st, 2011)
  #3 (permalink)  
Old September 1st, 2011, 08:24 PM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default

OK, Thanks.

Keith Z.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.