C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Next: The TextBox will appear on your form. Open the Properties panel and click on the lightning bolt icon.
Events: The lightning bolt will show you events that you can add. Double-click on the TextChanged event.
Also: If another part of the code changes the text of a TextBox, TextChanged will also be triggered.
Method that handles TextChanged event: VB.NET
Public Class Form1
Private Sub TextBox1_TextChanged(sender As Object,
e As EventArgs) Handles TextBox1.TextChanged
' Get TextBox reference from sender object.
' ... The TextBox1 could be used directly instead.
Dim t As TextBox = sender
' Assign the window's title to the Text of the TextBox.
' ... This is a string value.
Me.Text = t.Text
End Sub
End Class
Tip: This example does nothing useful, but it shows some important principles of using TextBox.
Text: We almost always use the Text property on TextBox. And TextChanged tends to lead to clearer program logic.
Property