Wrox Programmer Forums
| 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 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
  #1 (permalink)  
Old June 10th, 2013, 12:53 PM
Authorized User
Points: 179, Level: 3
Points: 179, Level: 3 Points: 179, Level: 3 Points: 179, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson 13, Ex. 3

Ok, I know what the project is supposed to do, and I can run the downloaded solution and it works.

I just have no idea what the code actually is doing, or what is making what happen.
  #2 (permalink)  
Old June 10th, 2013, 02:46 PM
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

I'm away from my books and computer right now so I don't remember the details, but in general you might skim the lesson again. It should be covering the techniques uses by the Try It and exercises.

I'll try to post more details later today.
__________________
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 June 10th, 2013, 06:41 PM
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

I think you'll have to work through the exercise's requirements one at a time. Don't try to tackle the whole thing at once. Just focus on each task. You can either try to do them yourself or study the code to see where each requirement is met. Here are some notes about them.
Create private fields named SessionIndex1, SessionIndex2, and so forth to hold the indexes of the user’s choices.
This just means create some public variables inside the main form.
When the user clicks an ellipsis button, display the session selection dialog shown on the top in Figure 13-3.
When the user clicks the button, create a new session selection form variable as in:

Code:
SelectionForm frm = new SelectionForm();
After creating the dialog but before displaying it, set its Text property to indicate the session time as shown in the figure.
Set the dialog's Text property as in:

Code:
frm.Text = "Whatever";
Also before displaying the dialog, use code similar to the following to tell the dialog about the user’s previous selection for this session. (The SessionIndex and SessionTitle variables are public fields defined by the dialog and discussed shortly.)

Code:
frm.SessionIndex = SessionIndex1;
So this to set the form's SessionIndex property to the value in the main form's SessionIndex1 variable.

Now that you've prepared the dialog, call the dialog's ShowDialog method to display it.
If the user clicks OK, use code similar to the following to save the index of the user’s choice and to display the session’s title.
If the ShowDialog method returns OK to the main program's code, use the code to save the user's selection.
Set the ListView’s FullRowSelect property to True and set its MultiSelect property to False.

Use the Properties window to define the ListView’s column headers. Select the ListView, click its Columns property, click the ellipsis to the right, and use the editor to define the headers.

Use the Properties window’s editors to define the ListView’s items. Select the ListView, click its Items property, click the ellipsis to the right, and use the editor to define the items. Set the Text property to determine an item’s text. Click the SubItems property and then click the ellipsis to the right to define the sub-items (Room and Speaker).
Do the previous three tasks to prepare the form.
Use the following code to create public fields to communicate with the main form:
This code is in the session selection form. The main form can see it (it's public) so that's how the two forms communicate.
Create a Load event handler that uses the following code to initialize the dialog. This code selects the proper session in the ListView control and then makes the control scroll if necessary so that session is visible.
This code is in the session selection form. It gets the form ready to use.
In the OK button’s Click event handler, use the following code to save the selected item’s index and title for the main form to use:
This code is also in the session selection form. It sets the public variable values for the main form to read.

Hopefully this will help you get started or help you understand what the example code does.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 13 - Try It...Seriously? MinusZero BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 6 June 10th, 2013 04:06 PM
Lesson 5 Try it TheMysticRuler BOOK: Stephens' Visual Basic Programming 24-Hour Trainer 7 January 20th, 2013 08:16 PM
Lesson 13 Exercise 3 1rf2aa3oa4tb BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 3 July 2nd, 2012 12:04 PM
Lesson 13 Try it error alawode BOOK: Knight's Microsoft Business Intelligence 24-Hour Trainer 4 January 27th, 2012 08:32 PM
Lesson 13: Task weird output gbargsley BOOK: Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services 0 August 3rd, 2011 11:07 AM





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