Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
| 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 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
  #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
  #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


  #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


  #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


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





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