[图片已过期]一旦用户开始输入字体,字体颜色应更改为黑色.任何帮助将不胜感激.解决方案像这样的东西吗?Private Sub UserForm_Initialize() TextBox1.ForeColor = &HC0C0C0 '<~~ Grey Color TextBox1.Text = "Please Enter Name Here" CommandButton1.SetFocus '<~~ This is required so that the focus moves from TBEnd SubPrivate Sub TextBox1_Enter() With TextBox1 If .Text = "Please Enter Name Here" Then .ForeColor = &H80000008 '<~~ Black Color .Text = "" End If End WithEnd SubPrivate Sub TextBox1_AfterUpdate() With TextBox1 If .Text = "" Then .ForeColor = &HC0C0C0 .Text = "Please Enter Name Here" End If End WithEnd Sub ScreenShot(实际) Basically I have a Userform that I have created, and I was wondering if it was possible to add Grey text that is there when the Userform loads but that disappears as soon as the user start to input text into the TextBox:[image expired]Once the user starts typing in the font color should change to black.Any help would be appreciated. 解决方案 Something Like this?Private Sub UserForm_Initialize() TextBox1.ForeColor = &HC0C0C0 '<~~ Grey Color TextBox1.Text = "Please Enter Name Here" CommandButton1.SetFocus '<~~ This is required so that the focus moves from TBEnd SubPrivate Sub TextBox1_Enter() With TextBox1 If .Text = "Please Enter Name Here" Then .ForeColor = &H80000008 '<~~ Black Color .Text = "" End If End WithEnd SubPrivate Sub TextBox1_AfterUpdate() With TextBox1 If .Text = "" Then .ForeColor = &HC0C0C0 .Text = "Please Enter Name Here" End If End WithEnd SubScreenShot (In action) 这篇关于文本输入时消失文本框文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-30 07:22