Wrox Programmer Forums
|
BOOK: Beginning Visual C#
This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D. Reid, Matthew Reynolds, Morgan Skinner, Eric White; ISBN: 9780764543821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 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 19th, 2003, 11:24 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 13 page 358

the book is just starting to get into the code here. the author claims there is not previous knowledge needed, but at this page he is throwing code at us and not telling us where it put it. the book has been complete and well written up to this point, but the example must be clear or it's useless.....

so, on page 358, where should this txtBoxEmpty_Validating... event go? in main? in the form1?

jtwl_
 
Old October 7th, 2003, 09:28 AM
Authorized User
 
Join Date: Oct 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

jtwl_,

Now I don't have the book you're working with but I down loaded the code to have a look at it and it appears that the event should go in its own method like this.

private void txtBoxEmpty_Validating(object sender,
                                            System.ComponentModel.CancelEventArgs e)
        {
            TextBox tb;

            tb = (TextBox)sender;

            // If the text is empty we set the background color of the
            // TextBox to red to indicate a problem. We use the tag value
            // of the control to indicate if the control contains valid
            // information.
            if (tb.Text.Length == 0)
            {
                tb.BackColor = Color.Red;
                tb.Tag = false;
            }
            else
            {
                tb.BackColor = System.Drawing.SystemColors.Window;
                tb.Tag = true;
            }

            // Finally we call ValidateAll which will set the value of
            // the OK button.
            ValidateAll();
        }

I hope this helps.

Jason

"Is the glass half full, half empty, or twice as large as it needs to be?"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page 468-474 Chapter 13 michaelcode BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 24th, 2006 09:00 AM
Chapter 13 page 444 DRAYKKO Beginning VB 6 1 April 19th, 2006 07:10 PM
chapter 13 building an index page drb2k2 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 March 5th, 2006 07:22 PM





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