Wrox Programmer Forums
|
BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8
This is the forum to discuss the Wrox book Wrox's Visual Basic 2005 Express Edition Starter Kit by Andrew Parsons; ISBN: 9780764595738
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8 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 August 30th, 2006, 03:16 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chaper 6: Try It Out question

I can't figure question 7 in the Try It Out "Creating Dynamic Buttons." The question reads: "Edit the Add Person Click event handler in the main form code to set the AddMode property to TRUE."

Any ideas?

EZ
 
Old August 30th, 2006, 09:20 PM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The project in the book does not function correctly. Nor does the downloadable version from this site. You are right at the chapter where everything goes awry.

I have been going back and forth, via email, about this and so far have been unsuccessful.

Code:
Private Sub btnAddPerson_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddPerson.Click
        objPersonalDetails = New PersonalDetails
        Dim objPerson As New Person("Glenda", "Brown")
        With objPerson
            .BirthDate = "1965-12-02"
            .Address = "333 Green Valley Way, Los Angeles, CA"
            .HomePhone = "(811) 8888 7777"
        End With
        objPersonalDetails.Person = objPerson
        Me.Text = "Personal Organizer - Viewing " + _
        objPersonalDetails.Person.DisplayName
        objPersonalDetails.AddMode = True

        If pnlMain.Controls.Contains(objPersonList) Then
            pnlMain.Controls.Remove(objPersonList)
            objPersonList = Nothing
        End If

        pnlMain.Controls.Add(objPersonalDetails)
        objPersonalDetails.Dock = DockStyle.Fill


Don't forget this in PersonalDetails.vb, though:

Code:
Public Class PersonalDetails
    Private mPerson As Person
    Private mAddMode As Boolean

    Public Property AddMode() As Boolean
        Get
            Return mAddMode
        End Get
        Set(ByVal value As Boolean)
            mAddMode = value
            If mAddMode = True Then
                SetUpButtons()
            Else
                RemoveButtons()
            End If
        End Set
    End Property
 
Old August 31st, 2006, 12:09 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much Steve.
I guess I shouldn't bother to finish this project.

EZ
 
Old August 31st, 2006, 12:41 PM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I wouldn't say forget it; you may very well get it to compile correctly.

Unfortunately, I, as well as others, can't get it to compile like advertised. At the very least it may be worth trying to figure out why it doesn't work and post it here.

 
Old May 14th, 2007, 08:02 AM
Registered User
 
Join Date: May 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try cahanging position of the buttons in the PersonalDetails.vb - Private Sub SetUpButtons() :

        With mSaveButton
            .Name = "btnSave"
            .Text = "Shrani"
            .Anchor = AnchorStyles.Bottom + AnchorStyles.Right
            .Top = Me.Height - (.Height + 30) //was +5
            .Left = Me.Width - (.Width + 100) // was +5
        End With

 mCancleButton:

            .Top = Me.Height - (.Height + 30)
            .Left = Me.Width - (.Width + 200)



 
Old March 25th, 2008, 05:32 AM
Authorized User
 
Join Date: Mar 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One error I found was with the code below;

Private Sub btnAddPerson_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddPerson.Click
        objPersonalDetails = New PersonalDetails
        Dim objPerson As New Person("Glenda", "Brown")
        With objPerson
            .BirthDate = "1965-12-02"
            .Address = "333 Green Valley Way, Los Angeles, CA"
            .HomePhone = "(811) 8888 7777"
        End With

The error concerns assigning the birth date and the line should read;
            .BirthDate = CType("1965-12-02", Date)

Just about to tackle the AddMode section so I will see how it goes.
 
Old March 26th, 2008, 06:37 AM
Authorized User
 
Join Date: Mar 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Had all sorts of problems getting the AddMode to work. In the end I copied in the code from the downloads and corrected the known errors, adjusted the txtNotes height and now it all seems to work. Haven't managed to find why my manual entry wouldn't work :) ...it appeared to be the same.:(






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chaper 6 Pivot transformation example?? japak BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 2 March 10th, 2006 12:05 AM
Chaper 14 - over $1000 problems ftb_tx BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 November 21st, 2004 09:15 PM
Probably an old question Aiken Drum Beginning PHP 6 March 21st, 2004 08:45 PM





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