Author Topic: Mimicking text boxes  (Read 459 times)

jfrancis

  • Newbie
  • *
  • Posts: 1
    • View Profile
Mimicking text boxes
« on: January 15, 2020, 05:42:43 PM »
I apologize if this has been asked before, but I am very new to AdvancedHMI and struggling with getting something that should be pretty basic to work. 

I am trying to create a textbox in which a user can enter a value that will then appear in another textbox without re-entry.  Basically, I want to be able to type "test" into textbox1 and have textbox2 and textbox3 populate with "test."

Phrog30

  • Guest
Re: Mimicking text boxes
« Reply #1 on: January 15, 2020, 05:57:49 PM »

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Mimicking text boxes
« Reply #2 on: January 15, 2020, 08:38:22 PM »
So you don't get scared or confused by those choices, the best event is probably the TextChanged event, to which you get by double-clicking the textbox:

Code: [Select]
    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        Me.TextBox4.Text = Me.TextBox3.Text 'Have the same text
        Me.TextBox5.Text = Me.TextBox3.Text 'Have the same text
    End Sub

Or you can have it reversed for fun:

Code: [Select]
    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        Me.TextBox4.Text = StrReverse(Me.TextBox3.Text) 'Have the reversed text
        Me.TextBox5.Text = StrReverse(Me.TextBox3.Text) 'Have the reversed text
    End Sub

Only in case of a palindrome the output is the same for either code (as the attached picture shows).

« Last Edit: January 15, 2020, 08:45:25 PM by Godra »