Skip to content

Instantly share code, notes, and snippets.

@Benshi
Created March 23, 2021 05:26
Show Gist options
  • Save Benshi/086f6482e754e2955b9d5448d9f7c975 to your computer and use it in GitHub Desktop.
Save Benshi/086f6482e754e2955b9d5448d9f7c975 to your computer and use it in GitHub Desktop.
TextChanged イベントを発生させずに TextBox の Text を書き換える
Public Module TextBoxBaseExtensions
<System.Runtime.CompilerServices.Extension>
Public Sub SetText(this As TextBoxBase, value As String)
Static forceWindowText As System.Reflection.MethodInfo = GetType(System.Windows.Forms.TextBoxBase).GetMethod("ForceWindowText", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
forceWindowText.Invoke(this, New Object(0) {value})
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment