Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 December 11th, 2007, 03:06 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15 - LabelTextboxTest

Adding a Custom Event Handler Section:

This code doesn't work:

Code:
        private void ctlLabelTextbox1_PaddingChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Changed");
        }
I downloaded the code off of the website and it doesn't even work.
there must be something wrong with the custom event. This might need to be fixed in the wrox book. i don't know.

if you put a break point on the messagebox.show it will not even hit when you click the button.

 
Old December 12th, 2007, 04:01 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Many Wrox books have more than fourteen chapters :) Can you say which book you're having problems with?

--

Joe (Microsoft MVP - XML)
 
Old December 12th, 2007, 06:57 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thought that i was posting under "Beginning Visual C# 2005" Book.


It was suppose to be posted under:
http://p2p.wrox.com/forum.asp?FORUM_ID=219
 
Old December 13th, 2007, 10:16 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Well nothing is probably happening because the event hasn't been 'wired' up with the code above. This is done witha line of code like this:

ctlLabelTextbox1.PaddingChanged += new System.EventHandler(ctlLabelTextbox1_PaddingChange d);

In Visual Studio this can be done by selecting the control in design view, and changing the property window to show the events. The drop down box next to PaddingChanged should list your method above.

http://msdn2.microsoft.com/en-us/library/Aa446496.completingthegame02(en-us,MSDN.10).gif

/- Sam Judson : Wrox Technical Editor -/
 
Old December 14th, 2007, 03:49 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is: Not sure what to do next.

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.ctlLabelTextbox1 = new LabelTextbox.ctlLabelTextbox();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // ctlLabelTextbox1
            //
            this.ctlLabelTextbox1.LabelText = "";
            this.ctlLabelTextbox1.Location = new System.Drawing.Point(51, 104);
            this.ctlLabelTextbox1.Name = "ctlLabelTextbox1";
            this.ctlLabelTextbox1.Position = LabelTextbox.ctlLabelTextbox.PositionEnum.Right;
            this.ctlLabelTextbox1.Size = new System.Drawing.Size(150, 20);
            this.ctlLabelTextbox1.TabIndex = 0;
            this.ctlLabelTextbox1.TextboxMargin = 0;
            this.ctlLabelTextbox1.TextboxText = "";
            this.ctlLabelTextbox1.PaddingChanged += new System.EventHandler(this.ctlLabelTextbox1_PaddingC hanged);
            //
            // button1
            //

 
Old December 15th, 2007, 09:39 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

OK, I've just realised something - you say the event doesn't fire when you Click the button - well that would be because its not the Click event, its the PaddingChanged event.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 - ciwluke BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2008 03:33 PM
chapter 15 help kyledonmoyer BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 June 30th, 2007 08:06 AM
Chapter 15 rrlevron BOOK: Beginning ASP 3.0 0 November 17th, 2005 03:38 PM
Chapter 15 moggie BOOK: Beginning ASP 3.0 2 October 19th, 2004 01:30 PM
Chapter 15 help Lorenzo_G BOOK: Beginning ASP 3.0 1 November 27th, 2003 01:00 PM





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