Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 22nd, 2010, 05:38 PM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 10 ex 1

Hello Rod,

I am stuck at exercise 1 of chapter 10 in your book.

The program does not copy the values of the textboxes in to the labels of the main window. I have also downloaded the exercise from your site but i can not find it. Is there something that i am forgetting?

thanks for your answer.

Joeri.
  #2 (permalink)  
Old December 23rd, 2010, 01:43 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 Joeri,

The EditContactForm doesn't do anything itself. The main program's code initializes the form, displays it, and if the user clicks OK displays the results in the TextBoxes.

Here's part of what's in the Edit button's Click event handler:

Code:
// Create the dialog.
EditContactForm editContactInfoDialog;
editContactInfoDialog = new EditContactForm();

// Initialize the dialog.
editContactInfoDialog.firstNameTextBox.Text = firstNameLabel.Text;
editContactInfoDialog.lastNameTextBox.Text = lastNameLabel.Text;
...

// Display the dialog and check the result.
if (editContactInfoDialog.ShowDialog() == DialogResult.OK)
{
    // Save the values entered by the user.
    firstNameLabel.Text = editContactInfoDialog.firstNameTextBox.Text;
    lastNameLabel.Text = editContactInfoDialog.lastNameTextBox.Text;
    ...
}
The code inside the "if" block is what copies the values back into the main form's TextBoxes.

If that code is there and it's not copying, then probably the problem is that the EditContactForm isn't returning OK. That would happen if its OK button's DialogResult property is not set to OK.

I would check that and if it doesn't work, let me know.
I have also downloaded the exercise from your site but i can not find it.
By that do you mean that you could not find the exercise? Or that you found it but couldn't see what made it work? My guess is that its the OK button's DialogResult property. It's often hard to notice the properties set at design time because they're not spelled out in code. (In fact, to make things more obvious, some developers set all non-default property values in code so it's easy to see what you changed.)

Let me know if this solves your problem.

Best wishes,
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
  #3 (permalink)  
Old December 23rd, 2010, 07:15 AM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rod,

It was the OK-buttons dialogproperty that was not returning the OK setting. Now it works good.

Thank u for your help.

Joeri.
 


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
Chapter 10, listing 10-10-app kiwibrit BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 2 August 18th, 2009 04:21 AM
Chapter 10 gogeo BOOK: Beginning Access 2003 VBA 1 January 22nd, 2006 09:41 AM
Chapter 10 czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 March 29th, 2005 09:35 AM
Chapter 10 columbiasmiles JSP Basics 0 May 17th, 2004 08:09 PM



All times are GMT -4. The time now is 05:17 AM.


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