Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Beginning Visual C#
|
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 April 15th, 2004, 10:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Default CODE CORRECTION - "RichTextBoxTest"

Problem:
Customer was going through the sample "RichTextBoxTest" within chapter 13
"Using Windows Form Controls".

The eventhandler "txtSize_Validating" in book is as followed:

private void txtSize_Validating(object sender, CancelEventArgs e)
{
TextBox txt = (TextBox)sender;
ApplyTextSize(txt.Text);
this.rtfText.Focus();
}

This will raise a convert exception when the TextBox.Text is empty, because
the is no check on the length of txt.Text.

Correction/fix:
Customer inserted the marked line:

private void txtSize_Validating(object sender, CancelEventArgs e)
{
TextBox txt = (TextBox)sender;
--> if (txt.Text.Length > 0)
ApplyTextSize(txt.Text);
this.rtfText.Focus();
}

XUMUSKIEFAN
Wrox Moderator
__________________
XUMUSKIEFAN
Wrox Moderator
 
Old April 24th, 2004, 02:58 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Another RichTextBoxTest question.I'm a beginner.
After I set the newfont,when I change the textsize,the original font(bold,italic,underline) will disappear.
Why?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent:hard disk serial code and vb code ivanlaw Pro VB 6 0 July 25th, 2007 04:05 AM
Page 123 - Login Box Correction xumuskiefan BOOK: Professional Crystal Reports for VS.NET 1 February 2nd, 2006 01:06 PM





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