Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Display Modes
  #1 (permalink)  
Old August 22nd, 2006, 08:35 PM
Registered User
 
Join Date: Aug 2006
Location: Schulenburg, TX, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Text Box .text Property Displays conflicting Valus

 Here is the Problem:

I created a user control called PersonalDetails,

Then in the code for the main form for a button (called 'new person') I added this code:
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 right 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
__________________
___________________________
In Him,
Joshua
Reply With Quote
  #2 (permalink)  
Old August 23rd, 2006, 06:30 AM
Authorized User
 
Join Date: Jul 2006
Location: Festac Town, Lagos, Nigeria.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dilionyi
Default

hello joshua,
try this in place of what u have

Private Sub TextBoxAddress_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBoxAddress.Click
        MsgBox(TextBoxAddress.Text)
End Sub

use the click event instead of the mouseclick event which u are using
hope this works


Reply With Quote
  #3 (permalink)  
Old August 23rd, 2006, 06:35 AM
Authorized User
 
Join Date: Jul 2006
Location: Festac Town, Lagos, Nigeria.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dilionyi
Default

sorry it should be this

Private Sub TextBoxAddress_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBoxAddress.Click
        MsgBox(TextBoxAddress.Text)
End Sub


Reply With Quote
  #4 (permalink)  
Old August 23rd, 2006, 02:39 PM
Registered User
 
Join Date: Aug 2006
Location: Schulenburg, TX, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, but that's not the problem,

The problem is that the same text box has two different values.
If you address it from the main form it says that the .text property is:

    "11432 FM 957"

while if you adress it from it's own control it says that the .text property is :

    ""

___________________________
In Him,
Joshua
Reply With Quote
Reply


Thread Tools
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
IMG Displays but text field is not displayed. shoakat ASP.NET 2.0 Professional 2 June 25th, 2007 06:04 AM
max length property of multiline text box MunishBhatia ASP.NET 2.0 Professional 5 June 14th, 2007 01:55 AM
Control a text box property from an Event rit01 ASP.NET 2.0 Basics 15 October 11th, 2006 02:33 PM
Can't set text property of dynamic text box sreerajrs ASP.NET 1.0 and 1.1 Professional 1 May 31st, 2006 09:39 PM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM



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


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