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 March 4th, 2008, 02:57 AM
Igo Igo is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Name 'GetPerson' is not declared.

Excuse me for the stupid question, I am absolute beginner in VB. In Public Class frmMainForm code Line 56 with the string:
Dim objPerson As Person = GetPerson(PersonID)
And I have GetPerson underlined with the error message:
Name 'GetPerson' is not declared.
Can somebody describe me where that GetPerson should be declared?
Thank you in advance,

 
Old March 28th, 2008, 03:39 PM
Authorized User
 
Join Date: Mar 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure what is causing your problem as I am a beginner myself but my code has got passed that bit and the first lines of the subroutine reads as follows;

Private Sub objPersonList_ShowPersonDetails(ByVal PersonID As Integer) Handles objPersonList.ShowPersonDetails
        objPersonalDetails = New PersonalDetails

        Dim objPerson As Person = GetPerson(PersonID)

Does yours read the same?

 
Old March 31st, 2008, 01:07 AM
Igo Igo is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for that reply. Yes I am reading the same code with the one difference - GetPerson is underlined as not declared.
    Private Sub objPersonList_ShowPersonDetails(ByVal PersonID As Integer) Handles objPersonList.ShowPersonDetails
        objPersonalDetails = New PersonalDetails

        Dim objPerson As Person = GetPerson(PersonID)
        objPersonalDetails.Person = objPerson
        objPersonalDetails.AddMode = False

        Me.Text = "Personal Organizer - Viewing " & _
            objPersonalDetails.Person.DisplayName

        If pnlMain.Controls.Contains(objPersonList) Then
            pnlMain.Controls.Remove(objPersonList)
            objPersonList = Nothing
        End If
        pnlMain.Controls.Add(objPersonalDetails)
        objPersonalDetails.Dock = DockStyle.Fill

    End Sub

 
Old April 1st, 2008, 05:42 AM
Authorized User
 
Join Date: Mar 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the General Functions section do you have the GetPerson function set as a Private Function. I had this problem with another function I had entered wrongly. It should be a Public Function so that the other modules can make use of it.
 
Old April 2nd, 2008, 12:26 AM
Igo Igo is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, in General functions section I have:
Imports System.Data
Module GeneralFunctions
    Public Function GetPerson(ByVal PersonID As Integer) As Person
        Dim GetPersonAdapter As New _PO_DataDataSetTableAdapters.PersonTableAdapter
        Dim GetPersonTable As New _PO_DataDataSet.PersonDataTable
        GetPersonAdapter.Fill(GetPersonTable)
        Dim PersonDataView As DataView = GetPersonTable.DefaultView
        PersonDataView.RowFilter = "ID = " + PersonID.ToString
        With PersonDataView
            If .Count > 0 Then
                Dim objPerson As New Person
                With .Item(0)
                    objPerson.ID = CType(.Item("ID"), Integer)
                    objPerson.FirstName = .Item("NameFirst").ToString.Trim
                    objPerson.LastName = .Item("NameLast").ToString.Trim
                    objPerson.HomePhone = .Item("PhoneHome").ToString.Trim
                    objPerson.CellPhone = .Item("PhoneCell").ToString.Trim
                    objPerson.Address = .Item("Address").ToString.Trim
                    objPerson.BirthDate = CType(.Item("DateOfBirth"), Date)
                    objPerson.EmailAddress = .Item("EmailAddress").ToString.Trim
                    objPerson.Favorites = .Item("Favorites").ToString.Trim
                    objPerson.GiftCategories = CType(.Item("GiftCategories"), Integer)
                    objPerson.Notes = .Item("Notes").ToString.Trim
                End With
                Return objPerson
            Else
                Return Nothing
            End If
        End With
    End Function
End Module

 
Old April 2nd, 2008, 12:42 AM
Igo Igo is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is solved!
Thank you for the promt of the solution!
I have no GeneralFunctions.vb module in Solution Explorer by mistake of my. After the module GeneralFunctions.vb had been attached to project the error message dissapeared. Thank you one more time!
Have a nice coding.






Similar Threads
Thread Thread Starter Forum Replies Last Post
BC30451: Name 'My' is not declared abc052107 Visual Studio 2005 0 July 2nd, 2007 11:01 PM
"Name My " not declared error ajkumar Visual Basic 2005 Basics 0 April 19th, 2007 11:29 PM
Name "Eval" is not declared. thuyvncr BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 December 21st, 2006 03:48 AM
FormsAuthentication not declared! Renu ASP.NET 1.0 and 1.1 Basics 2 October 6th, 2004 10:29 AM
Name 'Container' is not declared. surendran ASP.NET 1.0 and 1.1 Professional 1 August 17th, 2004 10:33 AM





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