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: 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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2006, 03:16 PM
Registered User
 
Join Date: Aug 2006
Location: Boston, MA, USA.
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
Reply With Quote
  #2 (permalink)  
Old August 30th, 2006, 09:20 PM
Registered User
 
Join Date: Aug 2006
Location: Lynden, WA, USA.
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
Reply With Quote
  #3 (permalink)  
Old August 31st, 2006, 12:09 PM
Registered User
 
Join Date: Aug 2006
Location: Boston, MA, USA.
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
Reply With Quote
  #4 (permalink)  
Old August 31st, 2006, 12:41 PM
Registered User
 
Join Date: Aug 2006
Location: Lynden, WA, USA.
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.

Reply With Quote
  #5 (permalink)  
Old May 14th, 2007, 08:02 AM
Registered User
 
Join Date: May 2007
Location: , , .
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)



Reply With Quote
  #6 (permalink)  
Old March 25th, 2008, 05:32 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
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.
Reply With Quote
  #7 (permalink)  
Old March 26th, 2008, 06:37 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
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.:(

Reply With Quote
Reply


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
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



All times are GMT -4. The time now is 11:28 AM.


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