DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006

    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
    Portland, OR
    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:
    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

    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
    Titwala, Tal-Kalyan
    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

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.