Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
TextBox に表示されるテキストに基づいて実行時に System.Windows.Forms.TextBox の ForeColor プロパティを設定しようとしていますが、Visual Studio によって設定されたプロパティ値をオーバーライドすることはありません。
VB Express 2010 を使用しています。
次のように、Textbox.TextChangedイベントを処理できます。
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged If TextBox1.Text.Length Mod 2 = 0 Then TextBox1.ForeColor = Color.Red Else TextBox1.ForeColor = Color.Blue End If End Sub