Text Box In Visual Basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ntamushobora
    New Member
    • Sep 2007
    • 1

    Text Box In Visual Basic

    I would to get codes which copy a content in text box into another one using visual basic 6.0
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by Ntamushobora
    I would to get codes which copy a content in text box into another one using visual basic 6.0
    Moved to Visual basic forum.
    Are the texboxes on the same form? Can you post the codes that you have so far?

    Comment

    • FullyH3ktik
      New Member
      • Sep 2007
      • 52

      #3
      If you want the text in the first text box to be displayed in the second text box as you write it, you do this:

      [CODE=vbnet]Private Sub TextBox1_TextCh anged(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles TextBox1.TextCh anged
      TextBox2.Text = TextBox1.Text
      End Sub[/CODE]

      Providing that the first text box is called TextBox1 and the second text box is called TextBox2


      If you want the text in the first text box to be displayed in the second text box when you press a button, use this:

      [CODE=vbnet]Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
      TextBox2.Text = TextBox1.Text
      End Sub[/CODE]
      Also Providing that the button is called Button1
      Last edited by Killer42; Sep 22 '07, 11:44 PM. Reason: Added CODE tags

      Comment

      • cryoburned
        New Member
        • Sep 2007
        • 23

        #4
        in vb6:

        Code:
        'without button
        Private Sub Text1_Change()
        Text2.Text = Text1.Text
        End Sub
        '
        'with button
        Private Sub Button1_Click()
        Text2.Text = Text1.Text
        End Sub

        Comment

        • jamesd0142
          Contributor
          • Sep 2007
          • 471

          #5
          textbox1.text = textbox2.text

          this copies the value in textbox2 into textbox1.

          Comment

          Working...