DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    1

    Question text from one form to another

    Hey people, I've only been programming for a week(literally) and I would really like it if you could help me with this...
    I have a textbox (txtName) on frmIntro and I want to get it to a label (lblMain) on frmMain. I've looked all over for it and all I find is .NET crap (I'm on VB6) So please help.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You can simply do this from within frmIntro:

    frmMain.lblMain.Caption = txtName.Text

    A cleaner approach, however, is to create a public property in frmMain and set the label's caption in the property's Let method:
    Code:
    Public Property Let LabelText(ByVal Text As String)
        lblMain.Caption = Text
    End Property
    Then to set the label text from frmIntro:

    frmMain.LabelText = txtName.Text

    Now frmIntro doesn't have to know the names or types of controls on frmMain.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2005
    Location
    Titwala, Tal-Kalyan
    Posts
    4
    You Can just copy this code.


    frmMain.lblMain.Caption = txtName.Text

Similar Threads

  1. Updating on screen text fields with multiple table data
    By William Ed Carden in forum VB Classic
    Replies: 2
    Last Post: 10-17-2005, 05:09 PM
  2. Label Control Text Alignment....
    By Boyd Campbell in forum .NET
    Replies: 3
    Last Post: 02-14-2003, 02:24 PM
  3. Replies: 7
    Last Post: 10-28-2002, 12:10 PM
  4. Get text from another programs form
    By LuCkY in forum VB Classic
    Replies: 8
    Last Post: 04-03-2001, 04:03 AM
  5. Partial Selection on a Input Text
    By Remy Lebeau in forum Web
    Replies: 2
    Last Post: 01-22-2001, 12:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links