Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics 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 16th, 2006, 09:13 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Classes and propertys

Hi, I am new to visual basic, and to this forum.
I have a question:
I created a class (called classPerson) , and gave it certain propertys,
then I created a property of my main forum called Person as ClassPerson
under the set part of the code I set varoius text boxes to the propertys of the class:
Example:
Code:
textboxSam.text = person.Name
textboxAddress = persen.Address
However when I Change the person.address property, the text box doesent change.

Do I need to specify it so it changes each time I change the person.address property or what?

___________________________
In Him,
Joshua
 
Old August 16th, 2006, 11:38 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The contents in the text box only are assessed when the control is created.
To get the textbox to reflect the changes to the source of its contents it will need to be refreshed.

You could add a collection to the class which holds a list of everything that uses the instance of the class, and when that instance has a property changed, it would go through its list of “clients,” sending them all notification of the change.

————————————————†”——————————
Also in Him,
Brian
 
Old August 16th, 2006, 11:46 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I thought that it might not update automaticly.
Thanks again, now I know.


___________________________
In Him,
Joshua
 
Old August 16th, 2006, 12:13 PM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here I have another Problem:

I created a user control called Personal details,
Then in the code for the button (called new person) I added this (among other things):

Code:
ObjPersonalDetails = New PersonalDetails
Later I asked the computer to:

Code:
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ObjPersonalDetails IsNot Nothing Then
            MsgBox(ObjPersonalDetails.TextBoxAddress.Text)
        End If
    End Sub


when I clicked the apropriat button:
the mesage box stated "11432 FM 957"
However In the code of personaldetails I included this:
Code:
    
Private Sub TextBoxAddress_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBoxAddress.MouseClick
        MsgBox(TextBoxAddress.Text)


    End Sub


When I clicked button1 msgbox: '11432 FM 957"
When I cliked on TextBoxAddress msgBox: ''

Does anyone know what is going on?


___________________________
In Him,
Joshua





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using classes seymour_glass C# 1 April 26th, 2007 10:18 PM
classes dhoward VB.NET 2002/2003 Basics 2 November 8th, 2006 10:35 AM
About Classes. wdw BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 29th, 2005 08:46 AM
Classes digby_dog VB.NET 2002/2003 Basics 1 May 2nd, 2005 09:12 PM
Classes CodeMonkeys C# 3 August 18th, 2004 11:14 AM





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