AdvancedHMI Software

General Category => Support Questions => Topic started by: jfrancis on January 15, 2020, 05:42:43 PM

Title: Mimicking text boxes
Post by: jfrancis 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."
Title: Re: Mimicking text boxes
Post by: Phrog30 on January 15, 2020, 05:57:49 PM
Search google for stuff like this, it’s all over the place.

https://stackoverflow.com/questions/13578670/how-to-pass-value-of-a-textbox-from-one-form-to-another-form
Title: Re: Mimicking text boxes
Post by: Godra 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).