DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: How to pass data from one form to another?

  1. #1
    Join Date
    Mar 2006
    Posts
    21

    How to pass data from one form to another?

    How to pass data from one form to another?
    i doing window application...For example, how can i get username from the login page while i am in the second page now?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Add a public property to the form that contains the data:
    Code:
    Public Class LoginForm : System.Windows.Forms.Form
        Private _UserName As String
        Public Property UserName() As String
            Get
                Return _UserName
            End Get
        End Property
    
        Private Sub btnLogin_Click(ByVal sender As System.Object, _ 
            ByVal e As System.EventArgs) Handles btnLogin.Click
            _UserName = txtUserName.Text
        End Sub
    End Class
    Then read the property from other forms:

    UserName = frmLogin.UserName
    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
    Mar 2006
    Posts
    21
    i using c#...can convert for me?
    i cant read vb code...thank you..

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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!

  5. #5
    Join Date
    Mar 2006
    Posts
    21
    thank you...

Similar Threads

  1. Replies: 4
    Last Post: 07-11-2002, 02:51 PM
  2. ASP.NET Data Form Wizard Control
    By max caber in forum .NET
    Replies: 0
    Last Post: 01-16-2002, 12:21 PM
  3. pass a form to a web user control (pagelet)
    By Annie Wang in forum ASP.NET
    Replies: 0
    Last Post: 05-24-2001, 04:07 PM
  4. Replies: 0
    Last Post: 02-01-2001, 05:02 AM

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


   Development Centers

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